public static int WaitAny(CEventHandle[] waitHandles, int millisecondsTimeout) { if (millisecondsTimeout < Timeout.Infinite) { throw new ArgumentOutOfRangeException("millisecondsTimeout"); } if (waitHandles == null || waitHandles.Any(w => w == null)) { throw new ArgumentNullException("waitHandles"); } long endTime = millisecondsTimeout == Timeout.Infinite ? Int64.MaxValue : millisecondsTimeout; var sw = Stopwatch.StartNew(); int sleepTime = 0; while (sw.ElapsedMilliseconds < endTime) { for (int ix = 0; ix < waitHandles.Length; ++ix) { if (waitHandles[ix].Wait(0)) { return(ix); } } CrestronEnvironment.Sleep(++sleepTime); } return(WaitTimeout); }
public void ShowAssertDialog(string stackTrace, string message, string detailMessage) { string fullMessage = message + Environment.NewLine + detailMessage + Environment.NewLine + stackTrace; Debug.WriteLine(fullMessage); if (Debugger.IsAttached) { Debugger.Break(); } else { #if SSHARP #else Environment.FailFast(fullMessage); #endif } }
public static void AllowOtherAppsToRun() { CrestronEnvironment.AllowOtherAppsToRun(); }
public static void Sleep(int timeoutInMsec) { CrestronEnvironment.Sleep(timeoutInMsec); }