예제 #1
0
        protected virtual void OnTaskStatusChangedHandler(object sender, TaskStatusChangedEventArgs e)
        {
            EventHandler <TaskStatusChangedEventArgs> handler = TaskStatusChanged;

            if (handler != null)
            {
                handler(this, e);
            }

            gsm.Evaluate();
        }
예제 #2
0
        protected virtual void OnStatusChanged(TaskStatusChangedInfo tsci)
        {
            AsyncCommandQueue queue = commandQueue;
            EventHandler <TaskStatusChangedEventArgs> handler = StatusChanged;

            if (queue != null)
            {
                queue.Register(new CommandWrapper(delegate {
                    TaskStatusChangedEventArgs e = new TaskStatusChangedEventArgs(tsci);
                    if (handler != null)
                    {
                        handler(this, e);
                    }
                }));
            }
            else if (handler != null)
            {
                ThreadPool.QueueUserWorkItem(delegate {
                    handler(this, new TaskStatusChangedEventArgs(tsci));
                });
            }
        }
예제 #3
0
파일: Task.cs 프로젝트: knocte/banshee
        protected virtual void OnStatusChanged(TaskStatusChangedInfo tsci)
        {
            AsyncCommandQueue queue = commandQueue;
            EventHandler<TaskStatusChangedEventArgs> handler = StatusChanged;

            if (queue != null) {
                queue.Register (new CommandWrapper (delegate {
                    TaskStatusChangedEventArgs e = new TaskStatusChangedEventArgs (tsci);
                    if (handler != null) {
                        handler (this, e);
                    }
                }));
            } else if (handler != null) {
                ThreadPool.QueueUserWorkItem (delegate {
                    handler (this, new TaskStatusChangedEventArgs (tsci));
                });
            }
        }
예제 #4
0
 private void OnDownloadTaskStatusChangedHandler(object sender, TaskStatusChangedEventArgs e)
 {
     if (e.StatusChanged != null) {
         lock (sync) {
             TaskStatusChanged (e.StatusChanged);
         }
     } else {
         lock (sync) {
             foreach (TaskStatusChangedInfo statusInfo in e.StatusesChanged) {
                 TaskStatusChanged (statusInfo);
             }
         }
     }
 }