Example #1
0
        public R ExecuteBusy <R>(IResultingBackgroundWorkerDelegate <R> busyDelegate)
        {
            IBusyToken token = AcquireBusyToken();

            try
            {
                return(busyDelegate.Invoke());
            }
            finally
            {
                token.Finished();
            }
        }
Example #2
0
        public void ExecuteBusy(IBackgroundWorkerDelegate busyDelegate)
        {
            IBusyToken token = AcquireBusyToken();

            try
            {
                busyDelegate.Invoke();
            }
            finally
            {
                token.Finished();
            }
        }
Example #3
0
        public void Finished(IBusyToken busyToken)
        {
            bool changed;

            lock (pendingTokens)
            {
                if (!pendingTokens.Remove(busyToken))
                {
                    throw new ArgumentException("Token not known");
                }
                changed = (pendingTokens.Count == 0);
            }
            GuiThreadHelper.InvokeInGui(delegate()
            {
                PropertyChanged(this, busyCountPCE);
                // Busy flag might evaluate to false
                if (changed)
                {
                    PropertyChanged(this, isBusyPCE);
                }
            });
        }
Example #4
0
 protected virtual void OnBeginBusy(IBusyToken token)
 {
 }
Example #5
0
 public BusyToken(IHasWeakReference vm, IBusyToken token)
     : this(vm, token.Message)
 {
     token.Register(this);
 }
Example #6
0
 public void OnCompleted(IBusyToken token)
 {
     Dispose();
 }