Пример #1
0
        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);
            }
        }
Пример #2
0
        /// <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);
            }
        }