private void DeleteButton_OnClick(object sender, RoutedEventArgs e) { string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; try { if (AskUserYesNo("Do you want to delete this structure from the Library?") == DialogResult.Yes) { var lib = new Database.Library(); lib.DeleteChemistry(((LibraryViewModel.Chemistry) this.DataContext).ID); Globals.Chem4WordV3.LoadNamesFromLibrary(); ParentControl.MainGrid.DataContext = new LibraryViewModel(); } } catch (Exception ex) { new ReportError(Globals.Chem4WordV3.Telemetry, Globals.Chem4WordV3.WordTopLeft, module, ex).ShowDialog(); } }
private void DeleteChemistry(IList eOldItems) { string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; try { if (!_initializing) { var lib = new Database.Library(); foreach (Chemistry chemistry in eOldItems) { lib.DeleteChemistry(chemistry.ID); } } } catch (Exception ex) { new ReportError(Globals.Chem4WordV3.Telemetry, Globals.Chem4WordV3.WordTopLeft, module, ex).ShowDialog(); } }