Beispiel #1
0
        public async Task GetState()
        {
            var state = await _vpnServiceManager.ConnectionState();

            var protocol = VpnProtocol.Auto;

            if (state != null)
            {
                _lastServer = _lastServerCandidates.ServerByEntryIp(state.EntryIp);
                State       = new VpnState(state.Status, _lastServer);
                protocol    = state.Protocol;
            }

            RaiseVpnStateChanged(new VpnStateChangedEventArgs(State, VpnError.None, false, protocol));
        }
Beispiel #2
0
        public void OnVpnStateChanged(VpnStateChangedEventArgs e)
        {
            var state = e.State;

            if (!string.IsNullOrEmpty(state.EntryIp))
            {
                _lastServer = _lastServerCandidates.ServerByEntryIp(state.EntryIp);
            }

            State           = new VpnState(state.Status, _lastServer);
            _networkBlocked = e.NetworkBlocked;

            RaiseVpnStateChanged(new VpnStateChangedEventArgs(State, e.Error, e.NetworkBlocked, e.Protocol));
        }
Beispiel #3
0
        public void OnVpnStateChanged(VpnStateChangedEventArgs e)
        {
            if (_guestHoleState.Active || _userStorage.User().Empty())
            {
                return;
            }

            VpnState state = e.State;

            if (!string.IsNullOrEmpty(state.EntryIp))
            {
                _lastServer = _lastServerCandidates.ServerByEntryIp(state.EntryIp);
            }

            _state          = new VpnState(state.Status, _lastServer);
            _networkBlocked = e.NetworkBlocked;

            RaiseVpnStateChanged(new VpnStateChangedEventArgs(_state, e.Error, e.NetworkBlocked, e.Protocol));
        }