private NetworkViewmodel() { this.downloading = new ObservableCollection <DownloadItem>(); this.Downloading = new ReadOnlyObservableCollection <DownloadItem>(this.downloading); this.allQueued = new ObservableCollection <DownloadItem>(); this.AllQueued = new ReadOnlyObservableCollection <DownloadItem>(this.allQueued); this.waitForDownloads = new ObservableQueue <DownloadItem>(); this.WaitForDownloads = new ReadonlyObservableQueue <DownloadItem>(this.waitForDownloads); this.cancellation = new CancellationTokenSource(); this.CancelAllCommand = new DelegateCommand(() => { this.CancelAllDownloads(); }, () => this.downloading.Count > 0 || this.waitForDownloads.Count > 0); this.downloading.CollectionChanged += (sender, e) => { ((DelegateCommand)this.CancelAllCommand).FireCanExecuteChanged(); }; this.waitForDownloads.CollectionChanged += (sender, e) => { ((DelegateCommand)this.CancelAllCommand).FireCanExecuteChanged(); }; this.DownloadLoop(); }
public ReadonlyObservableQueue(ObservableQueue <T> queue) { this.queue = queue; }