private void LoadMenu()
        {
            this.contextMenu1 = new ContextMenu(new MenuItem[] {
                this.enableItem = CreateMenuItem("Enable SOCK5 Proxy", new EventHandler(this.EnableItem_Click)),
                this.modeItem   = CreateMenuGroup("Mode", new MenuItem[] {
                    this.PACModeItem    = CreateMenuItem("PAC", new EventHandler(this.PACModeItem_Click)),
                    this.globalModeItem = CreateMenuItem("Global", new EventHandler(this.GlobalModeItem_Click))
                }),
                this.ServersItem = CreateMenuGroup("Servers", new MenuItem[] {
                    this.SeperatorItem = new MenuItem("-"),
                    this.ConfigItem    = CreateMenuItem("Edit Servers...", new EventHandler(this.Config_Click)),
                    CreateMenuItem("Show QRCode...", new EventHandler(this.QRCodeItem_Click)),
                    CreateMenuItem("Scan QRCode from Screen...", new EventHandler(this.ScanQRCodeItem_Click))
                }),
                new MenuItem("-"),
                this.AutoStartupItem  = CreateMenuItem("Start on Boot", new EventHandler(this.AutoStartupItem_Click)),
                this.ShareOverLANItem = CreateMenuItem("Allow Clients from LAN", new EventHandler(this.ShareOverLANItem_Click)),
                CreateMenuItem("Edit PAC File...", new EventHandler(this.EditPACFileItem_Click)),
                CreateMenuItem("Update PAC from GFWList", new EventHandler(this.UpdatePACFromGFWListItem_Click)),
                new MenuItem("-"),
                CreateMenuItem("Show Logs...", new EventHandler(this.ShowLogItem_Click)),
                CreateMenuItem("About...", new EventHandler(this.AboutItem_Click)),
                new MenuItem("-"),
                CreateMenuItem("Quit", new EventHandler(this.Quit_Click))
            });

            if (!SystemProxy.SupportChangeSysProxy())
            {
                this.modeItem.Enabled = false;
            }
        }
 private void controller_EnableStatusChanged(object sender, EventArgs e)
 {
     enableItem.Checked = controller.GetConfiguration().enabled;
     if (SystemProxy.SupportChangeSysProxy())
     {
         modeItem.Enabled = enableItem.Checked;
     }
 }
        private void LoadCurrentConfiguration()
        {
            Configuration config = controller.GetConfiguration();

            UpdateServersMenu();
            enableItem.Checked = config.enabled;
            if (SystemProxy.SupportChangeSysProxy())
            {
                modeItem.Enabled = config.enabled;
            }
            globalModeItem.Checked   = config.global;
            PACModeItem.Checked      = !config.global;
            ShareOverLANItem.Checked = config.shareOverLan;
            AutoStartupItem.Checked  = AutoStartup.Check();
        }