private void DownloadItem_StateChanged(object sender, DownloadSessionStateChangedEventArgs e) { var downloadItem = e.Session as DownloadItem; if (downloadItem == null) { return; } if (((e.OldState == DownloadState.Downloading) || (e.OldState == DownloadState.Paused) || (e.OldState == DownloadState.Ready)) && ((e.NewState == DownloadState.Cancelled) || (e.NewState == DownloadState.Failed) || (e.NewState == DownloadState.Success))) { Application.Current.Dispatcher.Invoke(() => { DownloadList.Remove(downloadItem); CompletedList.Add(downloadItem); }); } else if (CompletedList.Contains(downloadItem)) { Application.Current.Dispatcher.Invoke(() => { CompletedList.Remove(downloadItem); DownloadList.Add(downloadItem); }); } SetDownloadItemStatusText(downloadItem); }
private void OnStateChanged(object sender, DownloadSessionStateChangedEventArgs args) { RaisePropertyChanged(() => CanBeRemoved); RaisePropertyChanged(() => IsCanceled); RaisePropertyChanged(() => IsDownloaded); RaisePropertyChanged(() => IsDownloading); RaisePropertyChanged(() => IsFailed); RaisePropertyChanged(() => IsPaused); }