示例#1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            Server    tmp = new Server();
            AddServer ad  = new AddServer(dz.GetEncryption(), dz.GetObscuret(), ref tmp);

            if (ad.ShowDialog() == DialogResult.OK)
            {
                List <Server> tmplist = cfg.Servers.ToList();
                tmplist.Add(tmp);
                cfg.Servers = tmplist.ToArray();
                refreshList();
                SaveConfig();
                ApplyConfig(cfg.Servers.Length - 1);
            }
        }
示例#2
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            if (ServerList.SelectedIndices.Count == 0)
            {
                MessageBox.Show("未选中需要使用的配置", "提示");
                return;
            }
            int       sel = ServerList.SelectedIndices[0];
            Server    tmp = cfg.Servers[sel];
            AddServer ed  = new AddServer(dz.GetEncryption(), dz.GetObscuret(), ref tmp);

            if (ed.ShowDialog() == DialogResult.OK)
            {
                cfg.Servers[sel] = tmp;
                refreshList();
                SaveConfig();
                ApplyConfig(sel);
            }
        }