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) { LibraryModel.DeleteChemistry(((LibraryViewModel.Chemistry) this.DataContext).ID); Globals.Chem4WordV3.LibraryNames = LibraryModel.GetLibraryNames(); 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) { foreach (Chemistry chemistry in eOldItems) { LibraryModel.DeleteChemistry(chemistry.ID); } } } catch (Exception ex) { new ReportError(Globals.Chem4WordV3.Telemetry, Globals.Chem4WordV3.WordTopLeft, module, ex).ShowDialog(); } }