public static void WaitForDecentInternetConnection(double minimumInternetSpeed, int goodPings, int minimumGoodPings, int waitingTime) { while (true) { if (goodPings >= 0) { double myConnectionSpeed; do { myConnectionSpeed = CheckInternetSpeed(); if (!(myConnectionSpeed < minimumInternetSpeed)) { continue; } goodPings = minimumGoodPings; NotificationsHelper.DisplayDynamicMessage(Messages.WaitForBetterInternet(myConnectionSpeed)); ThreadsHelper.Sleep(waitingTime); } while (myConnectionSpeed < minimumInternetSpeed); goodPings--; continue; } break; } }
private static void HandleDownloadProgress(object sender, DownloadProgressChangedEventArgs eventArgs) { var percentage = Math.Round(eventArgs.BytesReceived / (float)eventArgs.TotalBytesToReceive * 100); NotificationsHelper.DisplayDynamicMessage(Messages.DownloadProgress(percentage)); }