private void RaiseNetworkChanged() { if (NetworkChanged != null) { NetworkChanged.Invoke(this, null); } }
//---------------------------------------- #region Public Methods #endregion //---------------------------------------- #region Protected Methods protected void OnNetworkChanged() { if (NetworkChanged != null) { NetworkChanged.Invoke(this, EventArgs.Empty); } }
public async Task DisconectAsync() { await m_client.LogoutAsync(); await m_client.StopAsync(); NetworkStatus = OnlineStatus.Offline; NetworkChanged?.Invoke(this, new NetworkChangedEventArgs(NetworkStatus)); }
private void OnNetworkChanged() { lock (_localIpAddressSyncLock) { _localIpAddresses = null; _macAddresses = null; } NetworkChanged?.Invoke(this, EventArgs.Empty); }
/* ----------------------------------------------------------------- */ /// /// OnNetworkChanged /// /// <summary> /// NetworkChanged イベントを発生させます。 /// </summary> /// /* ----------------------------------------------------------------- */ protected virtual void OnNetworkChanged(NetworkAvailabilityEventArgs e) { if (Network.Available && State == TimerState.Suspend) { Resume(TimeSpan.FromMilliseconds(100)); } else if (!Network.Available && State == TimerState.Run) { Suspend(); } NetworkChanged?.Invoke(this, e); }
public async Task ConnectAsync() { if (!Initialized) { await InitializeAsync(); } await m_client.LoginAsync(TokenType.Bot, Keys.UserToken); NetworkStatus = OnlineStatus.Online; ConnectedTime = DateTime.UtcNow; NetworkChanged?.Invoke(this, new NetworkChangedEventArgs(NetworkStatus)); await m_client.StartAsync(); }
/// <summary> /// Checks the current connection information and raises <see cref="NetworkChanged"/> if needed. /// </summary> private void UpdateConnectionInformation() { lock (ConnectionInformation) { try { ConnectionInformation.UpdateConnectionInformation(NetworkInformation.GetInternetConnectionProfile()); NetworkChanged?.Invoke(this, EventArgs.Empty); } catch { ConnectionInformation.Reset(); } } }
private void OnNetworkStatusChanged(object sender) { ConnectionProfile profile = null; try { profile = NetworkInformation.GetInternetConnectionProfile(); } catch { } ConnectionInformation.UpdateConnectionInformation(profile); NetworkChanged?.Invoke(this, EventArgs.Empty); }
public API() { HttpBaseProtocolFilter filter = new HttpBaseProtocolFilter(); filter.AutomaticDecompression = true; HttpClient http = new HttpClient(filter); cookieMonster = filter.CookieManager; client = http; loggedIn = false; gotInternet = false; //debug = true; network = new NetworkChanged(); Windows.Networking.Connectivity.NetworkInformation.NetworkStatusChanged += NetworkStatusChanged; }
public API(HttpClient http, string lastVis) { if (http == null) { throw new Exception("No client is provided"); } lastPage = lastVis; client = http; loggedIn = false; gotInternet = false; //debug = true; network = new NetworkChanged(); Windows.Networking.Connectivity.NetworkInformation.NetworkStatusChanged += NetworkStatusChanged; }
static NetworkHelper() { Microsoft.Toolkit.Uwp.Connectivity.NetworkHelper.Instance.NetworkChanged += (sender, e) => DispatcherHelper.ExecuteOnUIThreadAsync(() => NetworkChanged?.Invoke(sender, e)); }
public void OnNetworkChanged(string ips) { _ips = GetIpAddressesImpl(); NetworkChanged?.Invoke(ips); }
private void OnNetworkChange() { NetworkChanged?.Invoke(this, EventArgs.Empty); }
public void OnNetworkChanged(string ips) { NetworkChanged?.Invoke(ips); }