コード例 #1
0
 public void Run(Dispatcher dispatcher, Action todo, bool isFinal, CancelToken cancelToken, Thread subscribingThread)
 {
     if ((cancelToken != null) && cancelToken.IsCancellationRequested)
     {
         if (this._timer != null)
         {
             this._timer.Stop();
         }
         if (subscribingThread == Thread.CurrentThread)
         {
             cancelToken.ThrowIfCancelRequested();
         }
         else if (!this._isAborted)
         {
             this._isAborted = true;
             try
             {
                 subscribingThread.Abort();
             }
             catch
             {
             }
         }
     }
     if (this._timer == null)
     {
         this._timer = new DispatcherTimer(TimeSpan.FromMilliseconds(50.0), DispatcherPriority.Normal, new EventHandler(this.Tick), dispatcher);
         this._timer.Start();
     }
     lock (this._locker)
     {
         if (isFinal)
         {
             this._finalAction = todo;
         }
         else
         {
             this._action = todo;
         }
     }
 }
コード例 #2
0
 public void Run(Dispatcher dispatcher, Action todo, bool isFinal, CancelToken cancelToken, Thread subscribingThread)
 {
     if ((cancelToken != null) && cancelToken.IsCancellationRequested)
     {
         if (this._timer != null)
         {
             this._timer.Stop();
         }
         if (subscribingThread == Thread.CurrentThread)
         {
             cancelToken.ThrowIfCancelRequested();
         }
         else if (!this._isAborted)
         {
             this._isAborted = true;
             try
             {
                 subscribingThread.Abort();
             }
             catch
             {
             }
         }
     }
     if (this._timer == null)
     {
         this._timer = new DispatcherTimer(TimeSpan.FromMilliseconds(50.0), DispatcherPriority.Normal, new EventHandler(this.Tick), dispatcher);
         this._timer.Start();
     }
     lock (this._locker)
     {
         if (isFinal)
         {
             this._finalAction = todo;
         }
         else
         {
             this._action = todo;
         }
     }
 }