Пример #1
0
        void UpdateMenuItemCheckedStatHandler(object sender, EventArgs events)
        {
            var bs = setting.GetBasicSetting();
            var pm = bs.sysProxyMode;

            if (miProxyModeNone != null)
            {
                miProxyModeNone.Checked =
                    (int)Model.Data.Enum.SystemProxyModes.None == pm;
            }

            if (miProxyModeDirect != null)
            {
                miProxyModeDirect.Checked =
                    (int)Model.Data.Enum.SystemProxyModes.Direct == pm;
            }

            if (miProxyModeGlobal != null)
            {
                miProxyModeGlobal.Checked =
                    (int)Model.Data.Enum.SystemProxyModes.Global == pm;
            }

            if (miProxyModePac != null)
            {
                miProxyModePac.Checked =
                    (int)Model.Data.Enum.SystemProxyModes.PAC == pm;
            }
        }
Пример #2
0
        public void Restart()
        {
            var bs = setting.GetBasicSetting();
            var isStartPacServer = bs.isAlwaysStartPacServ;
            var isAutoMode       = bs.isAutoUpdateSysProxy;

            switch ((Model.Data.Enum.SystemProxyModes)bs.sysProxyMode)
            {
            case Model.Data.Enum.SystemProxyModes.Global:
                Libs.Sys.ProxySetter.SetGlobalProxy(bs.proxyPort);
                break;

            case Model.Data.Enum.SystemProxyModes.PAC:
                isStartPacServer = true;
                Libs.Sys.ProxySetter.SetPacProxy(pacServer.GetPacUrl());
                break;

            case Model.Data.Enum.SystemProxyModes.Direct:
                isAutoMode = false;
                Libs.Sys.ProxySetter.ClearSysProxy();
                break;

            default:
                isAutoMode = false;
                break;
            }

            if (isStartPacServer)
            {
                pacServer.Reload();
            }
            else
            {
                pacServer.StopPacServer();
            }

            if (isAutoMode)
            {
                //in case user not set any proxysetter settings yet
                OnCoreRunningStatChangeHandler(null, EventArgs.Empty);

                StartTracking();
            }
            else
            {
                StopTracking();
            }

            InvokeOnSysProxyChange();
        }
Пример #3
0
        public void Restart()
        {
            var bs = setting.GetBasicSetting();
            var isStartPacServer = bs.isAlwaysStartPacServ;
            var isStartTracker   = bs.isAutoUpdateSysProxy;

            switch ((Model.Data.Enum.SystemProxyModes)bs.sysProxyMode)
            {
            case Model.Data.Enum.SystemProxyModes.Global:
                Lib.Sys.ProxySetter.SetGlobalProxy(bs.proxyPort);
                break;

            case Model.Data.Enum.SystemProxyModes.PAC:
                isStartPacServer = true;
                Lib.Sys.ProxySetter.SetPacProxy(pacServer.GetPacUrl());
                break;

            case Model.Data.Enum.SystemProxyModes.Direct:
                isStartTracker = false;
                Lib.Sys.ProxySetter.ClearSysProxy();
                break;

            default:
                isStartTracker = false;
                break;
            }

            if (isStartPacServer)
            {
                pacServer.Reload();
            }
            else
            {
                pacServer.StopPacServer();
            }

            if (isStartTracker)
            {
                StartTracking();
            }
            else
            {
                StopTracking();
            }
        }