예제 #1
0
 public void AddWork(InvokeInUIThreadDelegate work)
 {
     if (isStarted)
     {
         throw new InvalidOperationException("MultiTaskHelper has already been started");
     }
     workItems.Enqueue(work);
 }
예제 #2
0
 public void AddWork(InvokeInUIThreadDelegate work)
 {
     if (isStarted)
     {
         throw new InvalidOperationException("MultiTaskHelper has already been started");
     }
     workItems.Enqueue(work);
 }
예제 #3
0
        public void Start()
        {
            isStarted = true;
            t.Stop();
            if (workItems.Count == 0)
            {
                Dispose();
                return;
            }

            InvokeInUIThreadDelegate item = workItems.Dequeue();

            if (item == null)
            {
                return;
            }

            item();
            t.Start();
        }
예제 #4
0
 /// <summary>
 /// Invoke a callback on a delayed timer.
 /// </summary>
 /// <param name="uiInvokeDelegate"></param>
 /// <param name="delayMillis"></param>
 public static Timer CallbackOnDelay(InvokeInUIThreadDelegate uiInvokeDelegate, int delayMillis)
 {
     return (new TimerHelper(uiInvokeDelegate)).Invoke(delayMillis);
 }
예제 #5
0
 private TimerHelper(InvokeInUIThreadDelegate uiInvokeDelegate)
 {
     _uiInvokeDelegate = uiInvokeDelegate;
 }
예제 #6
0
 /// <summary>
 /// Invoke a callback on a delayed timer.
 /// </summary>
 /// <param name="uiInvokeDelegate"></param>
 /// <param name="delayMillis"></param>
 public static Timer CallbackOnDelay(InvokeInUIThreadDelegate uiInvokeDelegate, int delayMillis)
 {
     return((new TimerHelper(uiInvokeDelegate)).Invoke(delayMillis));
 }
예제 #7
0
 private TimerHelper(InvokeInUIThreadDelegate uiInvokeDelegate)
 {
     _uiInvokeDelegate = uiInvokeDelegate;
 }