コード例 #1
0
        public static void ExecuteWhen(Func <bool> readyCondition, Action actionToExecute, double secondsBeforeRecheck = .1, double maxSecondsToWait = 1)
        {
            long            startTime = UiThread.CurrentTimerMs;
            RunningInterval interval  = null;

            void WaitForCondition()
            {
                var ready = readyCondition();

                if (ready || UiThread.CurrentTimerMs > startTime + maxSecondsToWait * 1000)
                {
                    if (ready)
                    {
                        actionToExecute();
                    }
                    UiThread.ClearInterval(interval);
                }
            }

            interval = UiThread.SetInterval(WaitForCondition, secondsBeforeRecheck);
        }
コード例 #2
0
ファイル: ToolTipManager.cs プロジェクト: tg73/agg-sharp
 public void Dispose()
 {
     // Unregister listeners
     systemWindow.MouseMove -= this.SystemWindow_MouseMove;
     UiThread.ClearInterval(runningInterval);
 }