public void OnDeleteArchiveButtonClicked(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("We won't be able to revert this operation...", "Are you really sure ?", MessageBoxButton.OKCancel, MessageBoxImage.Warning); if (result == MessageBoxResult.OK) { NoteEncryptCSManager.GetInstance().DeleteArchive(SettingsProvider.getInstance().LoadedArchive); ConnexionWindow connectWindow = new ConnexionWindow(); connectWindow.Show(); SettingsProvider.getInstance().PassPhrase = ""; this.Close(); } else if (result == MessageBoxResult.Cancel) { MessageBox.Show("I think that's a good decision.", "Yeah man !"); } }
void Listbox1_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (listbox1.SelectedIndex == -1) { loadedView.Visibility = Visibility.Hidden; SaveBtn.Visibility = Visibility.Hidden; RemoveBtn.Visibility = Visibility.Hidden; return; } ; loadedView.Visibility = Visibility.Visible; SaveBtn.Visibility = Visibility.Visible; RemoveBtn.Visibility = Visibility.Visible; int index = listbox1.SelectedIndex; //loadedView.DataContext = manager.NotesList.GetNote(index); loadedView.DataContext = SettingsProvider.getInstance().LoadedArchive.Notes[index]; }
private void Remove_Click(object sender, RoutedEventArgs e) { if (listbox1.SelectedIndex != -1) { try { int index = listbox1.SelectedIndex; ((Note)listbox1.Items.GetItemAt(index)).delete(); SettingsProvider.getInstance().LoadedArchive.Notes.RemoveAt(index); NewItemInput.Clear(); } catch (Exception exc) { MessageBox.Show("Unable to delete Note, error: " + exc.Message); } } else { MessageBox.Show("select oldNote for remove"); } }