示例#1
0
 public void Resolve(T data)
 {
     if (Canceled())
     {
         return;
     }
     finished?.Invoke(this, data);
     FinishReport(progressId);
 }
示例#2
0
        public bool Canceled()
        {
            if (!IsValid())
            {
                return(true);
            }

            if (cancelEvent == null)
            {
                return(false);
            }

            if (!cancelEvent.WaitOne(0))
            {
                return(false);
            }

            canceled = true;
            ClearReport();

            if (resolver != null)
            {
                Dispatcher.Enqueue(() => resolver.Invoke(this, null));
            }
            return(true);
        }
示例#3
0
        public void Resolve(T data, bool completed = true)
        {
            if (!IsValid())
            {
                return;
            }

            if (Canceled())
            {
                return;
            }
            resolver?.Invoke(this, data);
            if (completed)
            {
                Dispose();
            }
        }
示例#4
0
        public bool Canceled()
        {
            if (cancelEvent == null)
            {
                return(false);
            }

            if (!cancelEvent.WaitOne(0))
            {
                return(false);
            }

            canceled = true;
            ClearReport(progressId);

            if (finished != null)
            {
                Dispatcher.Enqueue(() => finished.Invoke(this, null));
            }
            return(true);
        }