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)); }
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)); }
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)); }