Esempio n. 1
0
        public void Reload(string rawPacServSetting)
        {
            Properties.Settings.Default.PacServerSettings = rawPacServSetting;
            Properties.Settings.Default.Save();

            InitControls();
            if (pacServer.isWebServRunning)
            {
                pacServer.RestartPacServer();
            }
        }
Esempio n. 2
0
        private void InitCtrlSysProxy(
            ToolStripMenuItem curSysProxySummary,
            ToolStripMenuItem copyCurPacUrl,
            ToolStripMenuItem visitCurPacDebuggerUrl,
            ToolStripMenuItem clearSysProxy,
            ToolStripMenuItem restartPACServer,
            ToolStripMenuItem stopPACServer)
        {
            this.restartPACServer   = restartPACServer;
            this.stopPACServer      = stopPACServer;
            this.curSysProxySummary = curSysProxySummary;

            // refresh check status
            OnPACServerStatusChangedHandler(this, EventArgs.Empty);

            pacServer.OnPACServerStatusChanged += OnPACServerStatusChangedHandler;

            restartPACServer.Click += (s, a) =>
            {
                pacServer.RestartPacServer();
            };

            stopPACServer.Click += (s, a) =>
            {
                pacServer.StopPacServer();
            };

            // misc
            clearSysProxy.Click += (s, a) =>
            {
                if (Lib.UI.Confirm(I18N.ConfirmClearSysProxy))
                {
                    pacServer.ClearSysProxy();
                }
            };

            visitCurPacDebuggerUrl.Click += (s, a) =>
            {
                var p   = setting.GetSysProxySetting();
                var url = p.autoConfigUrl;
                if (string.IsNullOrEmpty(url))
                {
                    MessageBox.Show(I18N.SetAnyServerAsPacServerFirst);
                    return;
                }
                Lib.UI.VisitUrl(I18N.VisitPacDebugger, url + "&debug=true");
            };

            copyCurPacUrl.Click += (s, a) =>
            {
                var p = Lib.Sys.ProxySetter.GetProxySetting();
                var u = p.autoConfigUrl;

                MessageBox.Show(
                    Lib.Utils.CopyToClipboard(u) ?
                    I18N.LinksCopied :
                    I18N.CopyFail);
            };
        }