示例#1
0
        /// <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();
                }
            }
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainForm"/> class.
        /// </summary>
        /// <param name="theProxyList">The proxy list.</param>
        public MainForm(SortableBindingList <ProxySetting> theProxyList)
        {
            InitializeComponent();

            _proxyList = theProxyList;
            _proxyList.Sort("Name", ListSortDirection.Ascending);
            this.proxyBindingSource.DataSource = _proxyList;

            this.gridProxySettings.Columns[0].HeaderCell.SortGlyphDirection = System.Windows.Forms.SortOrder.Ascending;
            this.gridProxySettings.Refresh();

            //Handle Power events
            SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);

            icnProxyNotifyIcon.ShowBalloonTip(1);             // when first opening display a balloon tip.

            checkForUpdatesToolStripMenuItem.Visible = ApplicationDeployment.IsNetworkDeployed;
        }