private TaskStatusChangedEventArgs(bool isSingle,
                                            TaskStatusChangedInfo status,
                                            TaskStatusChangedInfo[] statuses)
        {
            if (isSingle && status == null) {
                throw new ArgumentNullException ("status");
            } else if (!isSingle && statuses == null) {
                throw new ArgumentNullException ("statuses");
            }

            this.statusChanged = status;
            this.statusesChanged = statuses;
        }
        private TaskStatusChangedEventArgs(bool isSingle,
                                           TaskStatusChangedInfo status,
                                           TaskStatusChangedInfo[] statuses)
        {
            if (isSingle && status == null)
            {
                throw new ArgumentNullException("status");
            }
            else if (!isSingle && statuses == null)
            {
                throw new ArgumentNullException("statuses");
            }

            this.statusChanged   = status;
            this.statusesChanged = statuses;
        }
Beispiel #3
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));
                });
            }
        }
 public TaskStatusChangedEventArgs(TaskStatusChangedInfo status) : this(true, status, null)
 {
 }
Beispiel #5
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));
                });
            }
        }
Beispiel #6
0
        private void TaskStatusChanged(TaskStatusChangedInfo statusInfo)
        {
            HttpFileDownloadTask task = statusInfo.Task as HttpFileDownloadTask;

            if (task == null) {
                return;
            }

            FeedEnclosure enc = task.UserState as FeedEnclosure;

            if (enc == null) {
                return;
            }

            switch (statusInfo.NewStatus) {
            case TaskStatus.Stopped:
            case TaskStatus.Cancelled:
                enc.DownloadStatus = FeedDownloadStatus.None;
                break;
            case TaskStatus.Failed:
                enc.DownloadStatus = FeedDownloadStatus.DownloadFailed;
                break;
            case TaskStatus.Paused:
                enc.DownloadStatus = FeedDownloadStatus.Paused;
                break;
            case TaskStatus.Ready:
                enc.DownloadStatus = FeedDownloadStatus.Pending;
                break;
            case TaskStatus.Running:
                enc.DownloadStatus = FeedDownloadStatus.Downloading;
                //enc.Item.Feed.IncrementActiveDownloadCount ();
                break;
            case TaskStatus.Succeeded:
                break;
            }

            FeedsManager.Instance.FeedManager.OnItemChanged (enc.Item);

            if (statusInfo.OldStatus == TaskStatus.Running) {
                //enc.Item.Feed.DecrementActiveDownloadCount ();
            }
        }
 public TaskStatusChangedEventArgs(TaskStatusChangedInfo[] statuses)
     : this(false, null, statuses)
 {
 }
 public TaskStatusChangedEventArgs(TaskStatusChangedInfo status)
     : this(true, status, null)
 {
 }