예제 #1
0
 private void OnNetworkStatusChanged(object sender)
 {
     var handler = NetworkStatusChanged;
     if (handler != null)
     {
         var args = new NetworkStatusChangedEvents
         {
             IsOnline = IsOnline,
             NetworkType = NetworkType
         };
         handler.Invoke(this, args);
     }
 }
예제 #2
0
 private async void OnNetworkStatusChanged(object sender, NetworkStatusChangedEvents e)
 {
     using (await _networkMutex.LockAsync())
     {
         // It's safe to await while the lock is held
         if (e.IsOnline && e.NetworkType == NetworkType.Wifi)
         {
             await ResumeAllDownloadsAsync();
         }
         else
         {
             await PauseAllDownloadsAsync();
         }
     }
 }