void btnRefresh_Click(object sender, RoutedEventArgs e) { IsLoading = true; btnRefresh.IsEnabled = false; MissingFilesCollection.Clear(); FileCount = 0; StatusMessage = "Loading..."; workerFiles.RunWorkerAsync(); }
void workerFiles_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { contracts = e.Result as List <JMMServerBinary.Contract_MissingFile>; foreach (JMMServerBinary.Contract_MissingFile mf in contracts) { MissingFilesCollection.Add(new MissingFileVM(mf)); } FileCount = contracts.Count; ReadyToRemoveFiles = FileCount >= 1; btnRefresh.IsEnabled = true; IsLoading = false; this.Cursor = Cursors.Arrow; }
void btnDelete_Click(object sender, RoutedEventArgs e) { MessageBoxResult res = MessageBox.Show(string.Format("Are you sure you want to delete all these files from your AniDB list?"), "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question); if (res == MessageBoxResult.Yes) { IsLoading = true; btnRefresh.IsEnabled = false; btnDelete.IsEnabled = false; ReadyToRemoveFiles = false; StatusMessage = "Preparing to queue files for removal on server"; //Thread.Sleep(1500); List <MissingFileVM> mfs = new List <MissingFileVM>(MissingFilesCollection); workerDeleteFiles.RunWorkerAsync(mfs); MissingFilesCollection.Clear(); FileCount = 0; } }