private void RefreshData(bool refreshContinueWatching, bool refreshRecentAdditions, bool refreshOtherWidgets) { Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate() { Window parentWindow = Window.GetWindow(this); IsLoadingData = true; IsEnabled = false; parentWindow.Cursor = Cursors.Wait; RecentAdditionsType addType = RecentAdditionsType.Episode; if (cboDashRecentAdditionsType.SelectedIndex == 0) { addType = RecentAdditionsType.Episode; } if (cboDashRecentAdditionsType.SelectedIndex == 1) { addType = RecentAdditionsType.Series; } RefreshOptions opt = new RefreshOptions(); opt.RefreshContinueWatching = refreshContinueWatching; opt.RefreshRecentAdditions = refreshRecentAdditions; opt.RefreshOtherWidgets = refreshOtherWidgets; opt.RecentAdditionType = addType; refreshDataWorker.RunWorkerAsync(opt); }); }
void refreshDataWorker_DoWork(object sender, DoWorkEventArgs e) { try { RefreshOptions opt = e.Argument as RefreshOptions; VM_Dashboard.Instance.RefreshData(opt.RefreshContinueWatching, opt.RefreshRecentAdditions, opt.RefreshOtherWidgets, opt.RecentAdditionType); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }