private void UpdateStatus(Feed downloadItems, Feed entry, DownloadState downloadState, double percentage) { try { switch (downloadState) { case DownloadState.AllStart: ProgressBar.Value = 0; break; case DownloadState.AllFinished: Log.Text = "DONE!"; ProgressBar.Value = 0; downloadItems.Entries.Clear(); return; case DownloadState.DownloadProgressChanged: ProgressBar.Value = percentage; break; case DownloadState.TitleChanged: MixpanelTrack("Download", new {entry.Title, _settings.Guid}); break; } Log.Text = (entry != null) ? entry.ToString() : ""; } catch {} }
private void OnDownloadStatusChange(Feed downloadItems, Feed entry, DownloadState downloadState, double percentage) { Dispatcher.Invoke(new Action(() => { switch (downloadState) { case DownloadState.AllStart: Log.Text = "START"; ProgressBar.Value = 0; break; case DownloadState.AllFinished: Log.Text = "DONE!"; ProgressBar.Value = 0; downloadItems.Entries.Clear(); return; case DownloadState.DownloadProgressChanged: ProgressBar.Value = percentage; break; } if (entry != null) Log.Text = entry.ToString(); })); }