Exemplo n.º 1
0
 public void AddWork(InvokeInUIThreadDelegate work)
 {
     if (isStarted)
     {
         throw new InvalidOperationException("MultiTaskHelper has already been started");
     }
     workItems.Enqueue(work);
 }
Exemplo n.º 2
0
 public void AddWork(InvokeInUIThreadDelegate work)
 {
     if (isStarted)
     {
         throw new InvalidOperationException("MultiTaskHelper has already been started");
     }
     workItems.Enqueue(work);
 }
Exemplo n.º 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();
        }
Exemplo n.º 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);
 }
Exemplo n.º 5
0
 private TimerHelper(InvokeInUIThreadDelegate uiInvokeDelegate)
 {
     _uiInvokeDelegate = uiInvokeDelegate;
 }
Exemplo n.º 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));
 }
Exemplo n.º 7
0
 private TimerHelper(InvokeInUIThreadDelegate uiInvokeDelegate)
 {
     _uiInvokeDelegate = uiInvokeDelegate;
 }