コード例 #1
0
ファイル: MainForm.cs プロジェクト: mbp56789/AdvancedMgr-IE
        /// <summary>
        /// Edits the proxy.
        /// </summary>
        /// <param name="selectedProxyPosition">The selected proxy position in the array.</param>
        private void EditProxy(int selectedProxyPosition)
        {
            //make a copy of the current selected proxy setting so we can ignore when user cancels.
            ProxySetting     selectedProxy  = _proxyList[selectedProxyPosition].Clone();
            LanSettingDialog dlgLanSettings = new LanSettingDialog(selectedProxy);
            DialogResult     result         = dlgLanSettings.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                selectedProxy.SaveInConfigFile();
                //replace the one in the list
                _proxyList[selectedProxyPosition] = selectedProxy;
                this.gridProxySettings.Refresh();
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: mbp56789/AdvancedMgr-IE
        /// <summary>
        /// Handles the Click event of the btnAdd control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ProxyNamePromptDialog dlgNamePrompt = new ProxyNamePromptDialog(_proxyList);
            DialogResult          result        = dlgNamePrompt.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                ProxySetting newProxy = new ProxySetting();
                newProxy.Name = dlgNamePrompt.txtName.Text;

                LanSettingDialog dlgLanSettings = new LanSettingDialog(newProxy);
                result = dlgLanSettings.ShowDialog(this);
                if (result == DialogResult.OK)
                {
                    //don't add it until they've entered the data for it and saved it.
                    newProxy.SaveInConfigFile();
                    _proxyList.Add(newProxy);
                    _proxyList.Sort();
                }
            }
        }