Exemplo n.º 1
0
 private static int WachDelay = 3; //sec
 private static void StartWachInternetConnection()
 {
     Task.Run(async() =>
     {
         bool ICSnew;
         while (App.Live)
         {
             ICSnew = InternetConnetction();
             if (InternetConnectedState != ICSnew)
             {
                 if (ICSnew)
                 {
                     InternetConnectionRestored.Invoke();
                 }
                 else
                 {
                     InternetConnectionLost.Invoke();
                 }
                 InternetConnectedState = ICSnew;
             }
             await Task.Delay(WachDelay * 1000);
         }
     });
 }
Exemplo n.º 2
0
 private static readonly int WachDelay = 3; //sec
 private static void StartWachInternetConnection()
 {
     Task.Run(() =>
     {
         bool ICSnew;
         while (true)
         {
             ICSnew = InternetConnetction();
             if (InternetConnectionState != ICSnew)
             {
                 if (ICSnew)
                 {
                     InternetConnectionRestored.Invoke();
                 }
                 else
                 {
                     InternetConnectionLost.Invoke();
                 }
                 InternetConnectionState = ICSnew;
             }
             Thread.Sleep(WachDelay * 1000);
         }
     });
 }