public static async Task SleepAsync(TimeSpan time) { if (time.TotalMilliseconds < 0) { await Task.CompletedTask; } if (Board.Current.IsRaspberryPi) { HighResolutionTimer.Sleep(time); } else { await Task.Delay(time); } }
/// <summary> /// Sleeps during the specified time. /// </summary> /// <param name="time">The time.</param> public static void Sleep(TimeSpan time) { if (time.TotalMilliseconds < 0) { return; } if (Board.Current.IsRaspberryPi) { HighResolutionTimer.Sleep(time); } else { Thread.Sleep(time); } }