예제 #1
0
        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
                }
            }
예제 #3
0
 public static void AllowOtherAppsToRun()
 {
     CrestronEnvironment.AllowOtherAppsToRun();
 }
예제 #4
0
 public static void Sleep(int timeoutInMsec)
 {
     CrestronEnvironment.Sleep(timeoutInMsec);
 }