Example #1
0
        public void ShouldInvokeFinishedActionAfterAction()
        {
            const int delay = 10;

            Invoke.Later(() => { }, delay, TestFinishAction);

            AssertFinishActionIsInvoked(delay);
        }
Example #2
0
 private void ScheduleBusyMessageAnimation()
 {
     if (IsBusy)
     {
         Invoke.Later(
             () =>
         {
             _suffixIndex = (_suffixIndex + 1) % _suffixes.Length;
             RaisePropertyChanged(self => self.BusyMessageAnimated);
         }, AnimationRefreshDelayInMillis, ScheduleBusyMessageAnimation);
     }
 }
        /// <summary>
        ///     Invoked when the completion is closed, regardless of whether an item was applied or the completion was
        ///     cancelled. In the former case, invocation occurs before that of <see cref="HandleItemCompleted" />. Therefore,
        ///     it defers the notification of the handler(s) for some time, to make sure any <see cref="HandleItemCompleted" />
        ///     event arives first.
        /// </summary>
        private void HandleClosed(object sender, EventArgs eventArgs)
        {
            var isEscapePressed = Key.Escape.IsPressed();

            OnClosed();
            if (isEscapePressed)
            {
                _terminationTrigger = EventTrigger.Shortcut;
                OnCancel();
            }
            else
            {
                _delayedCancelAction = Invoke.Later(OnCancel, 10000);
            }
        }
Example #4
0
        public void ShouldInvokeImmediatelyWhenScheduledForPastDate()
        {
            Invoke.Later(TestAction, System.DateTime.Now.AddSeconds(-5));

            AssertActionIsInvoked(0);
        }
Example #5
0
        public void ShouldInvokeActionImmediatelyWhenScheduledForNow()
        {
            Invoke.Later(TestAction, System.DateTime.Now);

            AssertActionIsInvoked(0);
        }
Example #6
0
        public void ShouldInvokeActionAfterExplicitDelay(int delay)
        {
            Invoke.Later(TestAction, delay);

            AssertActionIsInvoked(delay);
        }
Example #7
0
        public void ShouldInvokeImmediatelyWhenScheduledWithNegativeDelay()
        {
            Invoke.Later(TestAction, -5);

            AssertActionIsInvoked(0);
        }
Example #8
0
        public void ShouldInvokeActionImmediatelyWhenScheduledWithNoDelay()
        {
            Invoke.Later(TestAction, 0);

            AssertActionIsInvoked(0);
        }
Example #9
0
        public void ShouldInvokeActionOnScheduleDate(int delay)
        {
            Invoke.Later(TestAction, System.DateTime.Now.AddMilliseconds(delay));

            AssertActionIsInvoked(delay);
        }
Example #10
0
 public ScheduledAction RegisterCallback(Action callback,
                                         DateTime timeForCallbackInvocation,
                                         Action finishedAction)
 {
     return(Invoke.Later(callback, timeForCallbackInvocation, finishedAction));
 }
Example #11
0
 public ScheduledAction RegisterCallback(Action callback, int delayInMillisecond)
 {
     return(Invoke.Later(callback, delayInMillisecond));
 }