private void btnClearLog_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBoxMgr.CreateNewResult("Are you sure you want to clear the error log?", "Clear Error Log?", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { eLog.ClearErrorLog(); textRange.Text = "There are currently no entries."; } }
private void wndEdit_Closed(object sender, CancelEventArgs e) { MessageBoxResult result = MessageBoxMgr.CreateNewResult("You will lose any unsaved changes. Proceed?", "Warning", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { UpdateSelectedFiles(); } else { e.Cancel = true; } }
private void btnCommit_Click(object sender, RoutedEventArgs e) { if (dgInfoBox.ItemsSource.Cast <Media>().Where(x => x.isChecked == true).ToList().Count > 0) { MessageBoxResult messageBoxCommit = MessageBoxMgr.CreateNewResult("Are you sure you want to save these changes? This cannot be undone.", "Edit Confirmation", MessageBoxButton.YesNo); if (messageBoxCommit == MessageBoxResult.Yes) { bool completedWithoutErrors = true; List <bool> listCompletion = new List <bool>(); BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += (o, ea) => { foreach (Media item in dgInfoBox.Items) { if (item.isChecked) { completedWithoutErrors = Media.WriteToShellFile(item); listCompletion.Add(completedWithoutErrors); } } }; worker.RunWorkerCompleted += (o, ea) => { //work has completed. you can now interact with the UI if (listCompletion.Contains(false)) { MessageBoxMgr.CompleteMessage(false); } else { MessageBoxMgr.CompleteMessage(true); } biIsWorking.IsBusy = false; }; biIsWorking.IsBusy = true; worker.RunWorkerAsync(); } } else { MessageBoxMgr.ItemsRequiredMessage(); } }