Declare a method to handle NetworkAvailabilityChanged events : NetworkChange : Network C# Examples


C# Examples » Network » NetworkChange »

 

Declare a method to handle NetworkAvailabilityChanged events









    
using  System;
using  System.Net.NetworkInformation;

class  MainClass
{
        
        private  static  void  NetworkAvailabilityChanged(object  sender,  NetworkAvailabilityEventArgs  e)
        {
                if  (e.IsAvailable)
                {
                        Console.WriteLine("Network  Available");
                }
                else
                {
                        Console.WriteLine("Network  Unavailable");
                }
        }

        static  void  Main(string[]  args)
        {
                NetworkChange.NetworkAvailabilityChanged  +=    NetworkAvailabilityChanged;
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Network
» NetworkChange