Пример #1
0
        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);
            };
        }
Пример #2
0
        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);
            };
        }