private void RaiseNetworkChanged()
 {
     if (NetworkChanged != null)
     {
         NetworkChanged.Invoke(this, null);
     }
 }
Esempio n. 2
0
        //----------------------------------------


        #region Public Methods

        #endregion


        //----------------------------------------


        #region Protected Methods
        protected void OnNetworkChanged()
        {
            if (NetworkChanged != null)
            {
                NetworkChanged.Invoke(this, EventArgs.Empty);
            }
        }
Esempio n. 3
0
        public async Task DisconectAsync()
        {
            await m_client.LogoutAsync();

            await m_client.StopAsync();

            NetworkStatus = OnlineStatus.Offline;
            NetworkChanged?.Invoke(this, new NetworkChangedEventArgs(NetworkStatus));
        }
Esempio n. 4
0
        private void OnNetworkChanged()
        {
            lock (_localIpAddressSyncLock)
            {
                _localIpAddresses = null;
                _macAddresses     = null;
            }

            NetworkChanged?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 5
0
 /* ----------------------------------------------------------------- */
 ///
 /// 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);
 }
Esempio n. 6
0
        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);
        }
Esempio n. 9
0
        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;
        }
Esempio n. 10
0
        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;
        }
Esempio n. 11
0
        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;
        }
Esempio n. 12
0
        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;
        }
Esempio n. 13
0
 static NetworkHelper()
 {
     Microsoft.Toolkit.Uwp.Connectivity.NetworkHelper.Instance.NetworkChanged +=
         (sender, e) => DispatcherHelper.ExecuteOnUIThreadAsync(() => NetworkChanged?.Invoke(sender, e));
 }
Esempio n. 14
0
 public void OnNetworkChanged(string ips)
 {
     _ips = GetIpAddressesImpl();
     NetworkChanged?.Invoke(ips);
 }
 private void OnNetworkChange()
 {
     NetworkChanged?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 16
0
 public void OnNetworkChanged(string ips)
 {
     NetworkChanged?.Invoke(ips);
 }