diff Implab/TaskController.cs @ 25:9bf5b23650c9

refactoring
author cin
date Thu, 06 Feb 2014 01:08:59 +0400
parents eb418ba8275b
children c761fc982e1d
line wrap: on
line diff
--- a/Implab/TaskController.cs	Thu Nov 14 01:15:07 2013 +0400
+++ b/Implab/TaskController.cs	Thu Feb 06 01:08:59 2014 +0400
@@ -12,7 +12,7 @@
     /// <remarks>
     /// Members of this object are thread safe.
     /// </remarks>
-    class TaskController: IProgressNotifier, ITaskController, ICancellable
+    public class TaskController: IProgressNotifier, ITaskController
     {
         readonly object m_lock;
         string m_message;
@@ -22,6 +22,7 @@
 
         bool m_cancelled;
 
+        public event EventHandler Cancelled;
         public event EventHandler<ValueEventArgs<string>> MessageUpdated;
         public event EventHandler<ValueEventArgs<float>> ProgressUpdated;
         public event EventHandler<ProgressInitEventArgs> ProgressInit;
@@ -84,7 +85,7 @@
             }
         }
 
-        public bool Cancelled {
+        public bool IsCancelled {
             get {
                 lock (m_lock)
                     return m_cancelled;
@@ -102,6 +103,13 @@
             }
         }
 
+        protected virtual void OnCancelled() {
+            var temp = Cancelled;
+            if (temp != null) {
+                temp(this,new EventArgs());
+            }
+        }
+
         protected virtual void OnMessageUpdated()
         {
             var temp = MessageUpdated;