Exemplo n.º 1
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:
                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:
                isAutoMode = false;
                Lib.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();
            }

            RegistHotKey();
            InvokeOnSysProxyChange();
        }
Exemplo n.º 2
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();
            }

            RegistHotKey();
            InvokeOnSysProxyChange();
        }