示例#1
0
 public static void EndWait()
 {
     if (Interlocked.Decrement(ref waitCounter) == 0)
     {
         AgVeil veil = Interlocked.Exchange <AgVeil>(ref waitVeil, null);
         if (veil == null)
         {
             return;
         }
         Action uiAction = () => {
             if (veil != null)
             {
                 veil.Hide();
             }
         };
         Dispatcher dispatcher = veil.dispatcher;
         if (!dispatcher.CheckAccess())
         {
             dispatcher.BeginInvoke(uiAction);
         }
         else
         {
             uiAction();
         }
     }
 }
 public static void BeginWait(bool grayed) {
     Dispatcher dispatcher = Application.Current.RootVisual.Dispatcher;
     if(!dispatcher.CheckAccess()) {
         throw new InvalidOperationException();
     }
     if(Interlocked.Increment(ref waitCounter) == 1) {
         Debug.Assert(waitVeil == null);
         waitVeil = new AgVeil();
         waitVeil.dispatcher = dispatcher;
         waitVeil.Show(null, grayed);
         ((FrameworkElement)waitVeil.clickCapture.Children[0]).Cursor = Cursors.Wait;
     }
 }
示例#3
0
        public static void BeginWait(bool grayed)
        {
            Dispatcher dispatcher = Application.Current.RootVisual.Dispatcher;

            if (!dispatcher.CheckAccess())
            {
                throw new InvalidOperationException();
            }
            if (Interlocked.Increment(ref waitCounter) == 1)
            {
                Debug.Assert(waitVeil == null);
                waitVeil            = new AgVeil();
                waitVeil.dispatcher = dispatcher;
                waitVeil.Show(null, grayed);
                ((FrameworkElement)waitVeil.clickCapture.Children[0]).Cursor = Cursors.Wait;
            }
        }