public static void DelayRun <T>(this Dispatcher dispatcher, Action <T> action, T paramater, int delay, DispatcherPriority priority = DispatcherPriority.Normal)
        {
            var timer = new DispatcherTimerWithAction(TimeSpan.FromSeconds(delay), priority,
                                                      dispatcher)
            {
                Action = () => action(paramater),
            };

            timer.Tick += OnTimeout;
            timer.Start();
        }
예제 #2
0
        public static void DelayRun(Action action, int delay, DispatcherPriority priority = DispatcherPriority.Normal)
        {
            var dispatcher = Dispatcher.CurrentDispatcher;
            var timer      = new DispatcherTimerWithAction(TimeSpan.FromSeconds(delay), priority,
                                                           dispatcher)
            {
                Action = action,
            };

            timer.Tick += UIDispatcherExtensions.OnTimeout;
            timer.Start();
        }