예제 #1
0
        /// <summary>
        ///     在每执行完一次任务之后,必须调用该函数
        /// </summary>
        protected virtual bool OnTaskProcessStarting()
        {
            lock (this)
            {
                IsTaskExecuting = false;
            }

            if (this.TaskProcessStarting != null)
            {
                try
                {
                    var e1 = new TaskProcessStartingEventArgs(this);

                    if (Manager != null)
                    {
                        Manager.OnTaskStarting(e1);

                        if (e1.Cancel)
                        {
                            return(false);
                        }
                    }

                    this.TaskProcessStarting(this, e1);

                    if (e1.Cancel)
                    {
                        return(false);
                    }
                }
                catch (Exception)
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #2
0
 internal void OnTaskStarting(TaskProcessStartingEventArgs e)
 {
     Events.EventHelper.Raise(TaskProcessStarted, this, e);
 }