示例#1
0
 void NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     if (e.IsAvailable)
     {
         this.Invoke((Action) delegate { RetrySend(); });
     }
     else
     {
         MessageBox.Show("网络已断开");
     }
 }
示例#2
0
 private static void NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     if (e.IsAvailable)
     {
         LogHelper.WriteLog("Network Available");
     }
     else
     {
         LogHelper.WriteLog("Network Unavailable");
     }
 }
示例#3
0
 private void AvailabilityChanged(object sx, NetworkAvailabilityEventArgs ex, exceptionMessage s, object fileName)
 {
     if (!ex.IsAvailable)
     {
         s($"{fileName.ToString()} : Connection lost");
     }
     else
     {
         s($"{fileName.ToString()} : Connection established");
     }
 }
示例#4
0
 private void AvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     if (e.IsAvailable)
     {
         Console.WriteLine("Network connected!");
     }
     else
     {
         Console.WriteLine("Network dis connected!");
     }
 }
示例#5
0
 private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     try
     {
         htServerPipePool.Clear();
         //KProxyApplication.Log.LogFormat("KProxy.network.availability.change> Network Available: {0}", new object[] { e.IsAvailable });
     }
     catch
     {
     }
 }
示例#6
0
 /// <summary>When Network availability changes, this method is invoked.</summary>
 public void OnNetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     if (e.IsAvailable)
     {
         login_window.DisplayNetworkAvailability("Network status: Available");
     }
     else
     {
         login_window.DisplayNetworkAvailability("Network status: Unavailable");
     }
 }
示例#7
0
        void NetworkChangeNetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
        {
            IsConnected = e.IsAvailable;
            UpdateStatus();
            ConnectionStatusChangedEventHandler handler = ConnectionStatusChangedEvent;

            if (handler != null)
            {
                handler(IsConnected);
            }
        }
 private static void NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     if (e.IsAvailable)
     {
         Console.WriteLine("Network Is Available");
     }
     else
     {
         Console.WriteLine("Network Is Not Available");
     }
 }
示例#9
0
 public void AvailabilityChanged(object sender, NetworkAvailabilityEventArgs e, IntenetSlow s, string filename)
 {
     if (e.IsAvailable)
     {
         s($"Connection Established : {filename}");
     }
     else
     {
         s($"Connection Not Available : {filename}");
     }
 }
示例#10
0
        private async void HandleNetworkChange(object sender, NetworkAvailabilityEventArgs e)
        {
            if (!waitingForConnectivity)
            {
                return;
            }

            if (e.IsAvailable)
            {
                await SynchronizeAsync().ConfigureAwait(false);
            }
        }
 void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     if (e.IsAvailable)
     {
         finito = true;
         Console.WriteLine("Network is Available");
     }
     else
     {
         Console.WriteLine("Network is Unavailable");
     }
 }
示例#12
0
        private async void OnNetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
        {
            if (!e.IsAvailable)
            {
                return;
            }

            foreach (var account in Accounts)
            {
                await account.TakeOnlineAsync();
            }
        }
示例#13
0
        private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
        {
            if (e.IsAvailable)
            {
                MessageBox.Show("Network is connected.");
            }

            else
            {
                MessageBox.Show("Network is not connected.");
            }
        }
示例#14
0
 // Signal or unsignal the network availability event when the network availability change
 private void NetworkAvailabilityChangeCallback(object sender, NetworkAvailabilityEventArgs e)
 {
     Log.Debug("Network availability changed: " + e.IsAvailable.ToString());
     if (e.IsAvailable)
     {
         networkUp.Set();
     }
     else
     {
         networkUp.Reset();
     }
 }
示例#15
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);
 }
示例#16
0
 private void AvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     if (e.IsAvailable)
     {
         HasInternet = e.IsAvailable;
         this.Init();
     }
     else
     {
         HasInternet = e.IsAvailable;
     }
 }
示例#17
0
        ///System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged
        ///System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged
        ///
        ///


        // Declare a method to handle NetworkAvailabilityChanged events.
        private static void NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
        {
            // Report whether the network is now available or unavailable.
            if (e.IsAvailable)
            {
                Console.WriteLine("Network Available");
            }
            else
            {
                Console.WriteLine("Network Unavailable");
            }
        }
示例#18
0
 /// <summary>
 /// <para>EventHandler of <see cref="NetworkChange.NetworkAvailabilityChanged"/></para>
 /// <para>Throws the event <see cref="OnNetworkAvailabilityChanged"/> if neccessary</para>
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     if (e.IsAvailable.Equals(oldValues[EventType.NetworkAvailabilityChanged]))
     {
         return;
     }
     if (OnNetworkAvailabilityChanged != null)
     {
         OnNetworkAvailabilityChanged(this, new EventArgsValue <bool>(e.IsAvailable));
     }
     oldValues[EventType.NetworkAvailabilityChanged] = e.IsAvailable;
 }
示例#19
0
 // 自訂當網路的有效性變更時所呼叫的方法
 private void NetworkAvailabilityChangedCallback(object sender, NetworkAvailabilityEventArgs e)
 {
     // 取得目前網路的連線狀態
     if (e.IsAvailable)
     {
         StatusBar.Text = "Network interface is up.";
     }
     else
     {
         StatusBar.Text = "The network is not available.";
     }
 }
示例#20
0
 private static void WhenNetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     if (e.IsAvailable)
     {
         Console.WriteLine("Network Available");
         new App().Start();
     }
     else
     {
         Console.WriteLine("Network Unavailable");
     }
 }
示例#21
0
 private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     if (!e.IsAvailable)
     {
         OnNetworkDead(new EventArgs());
         OnDisconnectedFromServer(new EventArgs());
     }
     else
     {
         OnNetworkAlived(new EventArgs());
     }
 }
示例#22
0
        private async void AvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
        {
            if (!e.IsAvailable)
            {
                await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
                {
                    Frame.Navigate(typeof(NoConnection));
                });
            }

            NetworkChange.NetworkAvailabilityChanged -= AvailabilityChanged;
        }
示例#23
0
        private void HandleNetworkChange(object sender, NetworkAvailabilityEventArgs e)
        {
            if (!waitingForConnectivity)
            {
                return;
            }

            if (e.IsAvailable)
            {
                Synchronize();
            }
        }
示例#24
0
 void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     if (e.IsAvailable)
     {
         Program.Init();
         Trace.WriteLine("Network became available");
     }
     else
     {
         Program.KillSocket();
         Trace.WriteLine("Network went down");
     }
 }
示例#25
0
 private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     if (e.IsAvailable)
     {
         //MessageBox.Show("Network connected!");
         lblmsg.Text = "Network connected!";
     }
     else
     {
         //MessageBox.Show("Network disconnected!");
         lblmsg.Text = "Network disconnected!";
     }
 }
 /// <summary>
 /// Prevent no-internet crashing
 /// (crashes anyways, but at least deleting the partial data and displaying a message to the uses)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     if (BeforeNetworkAvailabilityChangedHandling(sender, e))
     {
         return;
     }
     if (!e.IsAvailable)
     {
         MessageBox.Show("Internet access has dropped. Closing application...");
         ProtocolAbortCurrentDownload(true);
         Process.GetCurrentProcess().Kill();
     }
 }
示例#27
0
 private void networkChangedEvent(object sender, NetworkAvailabilityEventArgs e)
 {
     if (e.IsAvailable)
     {
         this.networkLabel.Text      = "Internet Available";
         this.networkLabel.ForeColor = Color.DarkGreen;
     }
     else
     {
         this.networkLabel.Text      = "Internet not Available";
         this.networkLabel.ForeColor = Color.DarkRed;
     }
 }
示例#28
0
 private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     logger.Debug("NetworkAvailabilityChanged got");
     if (e.IsAvailable)
     {
         logger.Trace("Network changed to up");
         isStillConnected(CHECKHOST);
     }
     else
     {
         logger.Trace("Network changed to down.");
     }
 }
 /// <summary>
 /// This event fires whenever all network adapters loose network connectivity (link) and fires when any network adapter re-gains a link.
 /// </summary>
 private static void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     IsNetworkAvailable = e.IsAvailable;
     if (e.IsAvailable)
     {
         Logger.Info("Network is now available.", ConsoleColor.Green);
     }
     else
     {
         Logger.Warning("Network is no longer available.");
         EnsuranceCancel.Cancel();
     }
 }
示例#30
0
        static void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
        {
            Debug.Print("Network available: " + e.IsAvailable.ToString());

            if (e.IsAvailable)
            {
                Time_Service.Start();
            }
            else
            {
                Time_Service.Stop();
            }
        }
示例#31
0
 private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     Debug.Print("Network availability: " + e.IsAvailable.ToString());
 }
示例#32
0
 private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
 }