Exemple #1
0
        void ManageServers(bool bFirstRun)
        {
            ServersDlg dlg = new ServersDlg();

            MainForm.SetControlFont(dlg, this.DefaultFont);

            string strWidths = this.AppInfo.GetString(
                "serversdlg",
                "list_column_width",
                "");

            if (String.IsNullOrEmpty(strWidths) == false)
            {
                ListViewUtil.SetColumnHeaderWidth(dlg.ListView,
                                                  strWidths,
                                                  true);
            }

            ServerCollection newServers = Servers.Dup();

            if (bFirstRun == true)
            {
                dlg.Text = "首次运行: 请指定服务器参数";
            }
            dlg.Servers = newServers;
            this.AppInfo.LinkFormState(dlg, "serversdlg_state");
            dlg.ShowDialog(this);
            this.AppInfo.UnlinkFormState(dlg);

            strWidths = ListViewUtil.GetColumnWidthListString(dlg.ListView);
            this.AppInfo.SetString(
                "serversdlg",
                "list_column_width",
                strWidths);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            // this.Servers = newServers;
            this.Servers.Import(newServers);
        }
Exemple #2
0
        private void menuItem_serversCfg_Click(object sender, System.EventArgs e)
        {
            ServersDlg dlg = new ServersDlg();

            MainForm.SetControlFont(dlg, this.DefaultFont);

            ServerCollection newServers = Servers.Dup();

            string strWidths = this.AppInfo.GetString(
                "serversdlg",
                "list_column_width",
                "");

            if (String.IsNullOrEmpty(strWidths) == false)
            {
                ListViewUtil.SetColumnHeaderWidth(dlg.ListView,
                                                  strWidths,
                                                  true);
            }

            dlg.Servers = newServers;

            this.AppInfo.LinkFormState(dlg, "serversdlg_state");
            dlg.ShowDialog(this);
            this.AppInfo.UnlinkFormState(dlg);

            strWidths = ListViewUtil.GetColumnWidthListString(dlg.ListView);
            this.AppInfo.SetString(
                "serversdlg",
                "list_column_width",
                strWidths);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            // this.Servers = newServers;
            this.Servers.Import(newServers);

            // this.treeView_res.Servers = this.Servers;
            treeView_res.Fill(null);
        }