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; }
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) { }
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)); }); } }
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) { }