public XsocksApplicationContext(XsocksController controller) { Application.ApplicationExit += OnApplicationExit; BuildMenu(); _controller = controller; controller.EnableStatusChanged += ControllerEnableStatusChanged; controller.ConfigChanged += ControllerConfigChanged; controller.PacFileReadyToOpen += ControllerFileReadyToOpen; controller.UserRuleFileReadyToOpen += ControllerFileReadyToOpen; controller.ShareOverLanStatusChanged += ControllerShareOverLanStatusChanged; controller.EnableGlobalChanged += ControllerEnableGlobalChanged; controller.Errored += ControllerErrored; controller.UpdatePacFromGfwListCompleted += ControllerUpdatePACFromGFWListCompleted; controller.UpdatePacFromGfwListError += ControllerUpdatePACFromGFWListError; _trayIcon = new NotifyIcon { Visible = true }; _trayIcon.MouseDoubleClick += TrayIconDoubleClick; _trayIcon.ContextMenu = _trayIconContextMenu; UpdateTrayIcon(); LoadCurrentConfiguration(); if (controller.GetConfiguration().IsDefault) { _isFirstRun = true; ShowConfigForm(); } }