private void DeleteWordCardBtn_Click(object sender, RoutedEventArgs e) { WordCard wc = UnSerializeXmlElement <WordCard>(listViewWordCards.SelectedItem as XmlElement); int index = listViewWordCards.SelectedIndex; DeleteConfirmation deleteDialog = new DeleteConfirmation(wc.Word); deleteDialog.Owner = Window.GetWindow(this); deleteDialog.ShowDialog(); if (deleteDialog.GetResult()) { DictionaryLoader.ActiveDictionary.Dictionary.RemoveAt(index); DictionaryLoader.ActiveDictionary.UpdateDictionaryXml(); LoadXmlWithWordCards(); // update output } }
private void DeleteDictionaryMenu_Click(object sender, RoutedEventArgs e) { if (listBoxDictionaries.SelectedItem as XmlElement != null) { DictionaryNameAndAmount d = UnSerializeXmlElement <DictionaryNameAndAmount>(listBoxDictionaries.SelectedItem as XmlElement); DeleteConfirmation dialogConfirm = new DeleteConfirmation(d.Name); dialogConfirm.Owner = Window.GetWindow(this); dialogConfirm.ShowDialog(); if (dialogConfirm.GetResult()) { DictionaryLoader.DeleteDictionary(d); } string path = @"data/users/" + DictionaryLoader.ActiveUser + @"/system.xml"; XmlDocument doc = new XmlDocument(); doc.Load(path); xmlDataProvider.Document = doc; } }