public FormMain( Services.PsSettings setting, Services.PacServer pacServer, Services.ServerTracker servTracker) { this.setting = setting; this.pacServer = pacServer; this.servTracker = servTracker; this.FormClosing += (s, a) => { var confirm = true; if (!setting.isCleaning && !this.formVGCPluginCtrl.IsOptionsSaved()) { confirm = VgcApis.Libs.UI.Confirm(I18N.ConfirmCloseWinWithoutSave); } if (confirm) { ReleaseUpdateTimer(); formVGCPluginCtrl.Cleanup(); } else { a.Cancel = true; } }; InitializeComponent(); }
private void BindEvents( Services.PacServer pacServer, Button btnRestart, Button btnStop, Button btnDebug, Button btnCopy, Button btnClearSysProxy) { btnClearSysProxy.Click += (s, a) => Lib.Sys.ProxySetter.ClearSysProxy(); btnRestart.Click += (s, a) => pacServer.StartPacServer(); btnStop.Click += (s, a) => pacServer.StopPacServer(); btnDebug.Click += (s, a) => vgcUtils.VisitUrl( I18N.VisitPacDebugger, GetDebugUrl()); btnCopy.Click += (s, a) => { MessageBox.Show( vgcUtils.CopyToClipboard(this.lbPacUrl.Text) ? I18N.CopySuccess : I18N.CopyFail); }; }
public TabStatus( Services.PacServer pacServer, Label lbPacServerStatus, Label lbPacUrl, Button btnRestart, Button btnStop, Button btnViewInNotepad, Button btnDebug, Button btnCopy) { this.pacServer = pacServer; BindControls(lbPacServerStatus, lbPacUrl); BindEvents( pacServer, btnRestart, btnStop, btnViewInNotepad, btnDebug, btnCopy); OnPacServerStateChangedHandler(null, EventArgs.Empty); pacServer.OnPACServerStateChanged += OnPacServerStateChangedHandler; }
public TabStatus( VgcApis.Models.IUtils vgcUtils, Services.PsSettings setting, Services.PacServer pacServer, Label lbPacServerStatus, Label lbPacUrl, Button btnRestart, Button btnStop, Button btnDebug, Button btnCopy, Button btnClearSysProxy) { this.vgcUtils = vgcUtils; this.setting = setting; this.pacServer = pacServer; BindControls(lbPacServerStatus, lbPacUrl); BindEvents( pacServer, btnRestart, btnStop, btnDebug, btnCopy, btnClearSysProxy); OnPacServerStateChangedHandler(null, EventArgs.Empty); pacServer.OnPACServerStateChanged += OnPacServerStateChangedHandler; }
private void BindEvents( Services.PacServer pacServer, Button btnRestart, Button btnStop, Button btnSaveAs, Button btnDebug, Button btnCopy, Button btnClearSysProxy) { btnSaveAs.Click += (s, a) => { VgcApis.Libs.UI.SaveToFile( VgcApis.Models.Consts.Files.PacExt, pacServer.GetCurPacFileContent()); }; btnClearSysProxy.Click += (s, a) => Lib.Sys.ProxySetter.ClearSysProxy(); btnRestart.Click += (s, a) => pacServer.StartPacServer(); btnStop.Click += (s, a) => pacServer.StopPacServer(); btnDebug.Click += (s, a) => VgcApis.Libs.UI.VisitUrl( I18N.VisitPacDebugger, GetDebugUrl()); btnCopy.Click += (s, a) => { MessageBox.Show( VgcApis.Libs.Utils.CopyToClipboard(this.lbPacUrl.Text) ? I18N.CopySuccess : I18N.CopyFail); }; }
public static FormMain CreateForm( Services.PsSettings setting, Services.PacServer pacServer, Services.ServerTracker servTracker) { FormMain r = null; VgcApis.Misc.UI.Invoke(() => { r = new FormMain(setting, pacServer, servTracker); }); return(r); }
private void BindEvents( Services.PacServer pacServer, Button btnRestart, Button btnStop, Button btnViewInNotepad, Button btnDebug, Button btnCopy, Button btnClearSysProxy) { btnViewInNotepad.Click += (s, a) => { try { var content = pacServer.GetCurPacFileContent(); VgcApis.Libs.Sys.NotepadHelper.ShowMessage( content, @"PAC.js"); } catch { VgcApis.Libs.UI.MsgBoxAsync(I18N.LaunchNotepadFail); } }; btnClearSysProxy.Click += (s, a) => Lib.Sys.ProxySetter.ClearSysProxy(); btnRestart.Click += (s, a) => pacServer.StartPacServer(); btnStop.Click += (s, a) => pacServer.StopPacServer(); btnDebug.Click += (s, a) => VgcApis.Libs.UI.VisitUrl( I18N.VisitPacDebugger, GetDebugUrl()); btnCopy.Click += (s, a) => { MessageBox.Show( VgcApis.Libs.Utils.CopyToClipboard(this.lbPacUrl.Text) ? I18N.CopySuccess : I18N.CopyFail); }; }
public FormMain( VgcApis.Models.IUtils vgcUtils, Services.PsSettings setting, Services.PacServer pacServer, Services.ServerTracker servTracker) { this.vgcUtils = vgcUtils; this.setting = setting; this.pacServer = pacServer; this.servTracker = servTracker; this.FormClosing += (s, a) => { var confirm = true; if (!setting.isCleaning && !this.formVGCPluginCtrl.IsOptionsSaved()) { confirm = vgcUtils.Confirm(I18N.ConfirmCloseWinWithoutSave); } if (confirm) { ReleaseUpdateTimer(); formVGCPluginCtrl.Cleanup(); } else { a.Cancel = true; } }; InitializeComponent(); #if DEBUG this.Icon = Properties.Resources.icon_light; #else this.Icon = Properties.Resources.icon_dark; #endif this.Show(); }