Пример #1
0
        /// <summary>
        /// Request that this task stops.
        /// </summary>
        public void Stop(bool allowCurrentFileToFinish)
        {
            if (m_parent != null)
            {
                m_parent.Stop(allowCurrentFileToFinish);
            }
            else
            {
                lock (m_lock)
                    if (m_controlState != TaskControlState.Abort)
                    {
                        m_controlState = TaskControlState.Stop;
                        m_pauseEvent.Set();
                        if (!allowCurrentFileToFinish)
                        {
                            m_taskController.Stop(true);
                        }
                    }

                if (StateChangedEvent != null)
                {
                    StateChangedEvent(m_controlState);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Request that THE CURRENT THREAD aborts.
        /// </summary>
        public void Abort()
        {
            lock (m_lock)
            {
                m_controlState = TaskControlState.Abort;
                m_pauseEvent.Set();
            }

            if (StateChangedEvent != null)
            {
                StateChangedEvent(m_controlState);
            }
        }
Пример #3
0
        /// <summary>
        /// Request that THE CURRENT THREAD stops.
        /// </summary>
        public void Stop()
        {
            lock (m_lock)
                if (m_controlState != TaskControlState.Abort)
                {
                    m_controlState = TaskControlState.Stop;
                    m_pauseEvent.Set();
                }

            if (StateChangedEvent != null)
            {
                StateChangedEvent(m_controlState);
            }
        }
Пример #4
0
        /// <summary>
        /// Request that THE CURRENT THREAD resumes.
        /// </summary>
        public void Resume()
        {
            lock (m_lock)
                if (m_controlState == TaskControlState.Pause)
                {
                    m_pauseEvent.Set();
                    m_controlState = TaskControlState.Run;
                }

            if (StateChangedEvent != null)
            {
                StateChangedEvent(m_controlState);
            }
        }
Пример #5
0
        /// <summary>
        /// Request that this task pauses.
        /// </summary>
        public void Pause()
        {
            if (m_parent != null)
            {
                m_parent.Pause();
            }
            else
            {
                lock (m_lock)
                    if (m_controlState == TaskControlState.Run)
                    {
                        m_pauseEvent.Reset();
                        m_controlState = TaskControlState.Pause;
                    }

                if (StateChangedEvent != null)
                {
                    StateChangedEvent(m_controlState);
                }
            }
        }
Пример #6
0
 /// <summary>
 /// Request that this task aborts.
 /// </summary>
 public void Abort()
 {
     lock(m_lock)
     {
         m_controlState = TaskControlState.Abort;
         m_pauseEvent.Set();
     }
     
     if (StateChangedEvent != null)
         StateChangedEvent(m_controlState);
 }
Пример #7
0
 /// <summary>
 /// Request that this task stops.
 /// </summary>
 public void Stop() 
 {
     lock(m_lock)
         if (m_controlState != TaskControlState.Abort)
         {
             m_controlState = TaskControlState.Stop;
             m_pauseEvent.Set();
         }
     
     if (StateChangedEvent != null)
         StateChangedEvent(m_controlState);
 }
Пример #8
0
 /// <summary>
 /// Request that this task resumes.
 /// </summary>
 public void Resume()
 {
     lock(m_lock)
         if (m_controlState == TaskControlState.Pause)
         {
             m_pauseEvent.Set();
             m_controlState = TaskControlState.Run;
         }
     
     if (StateChangedEvent != null)
         StateChangedEvent(m_controlState);
 }