private void cmdOK_Click(object sender, RoutedEventArgs e) { try { var note = PNStatic.Notes.Note(_ID); if (note != null) { switch (_Mode) { case ExchangeLists.Tags: note.Tags.Clear(); foreach (var n in lstCurrent.Items.OfType <KeyValuePair <string, TextBlock> >()) { note.Tags.Add(n.Value.Text); } PNNotesOperations.SaveNoteTags(note); note.RaiseTagsChangedEvent(); break; case ExchangeLists.LinkedNotes: note.LinkedNotes.Clear(); foreach (var n in lstCurrent.Items.OfType <KeyValuePair <string, TextBlock> >()) { note.LinkedNotes.Add((string)n.Value.Tag); } PNNotesOperations.SaveLinkedNotes(note); break; } } DialogResult = true; } catch (Exception ex) { PNStatic.LogException(ex); } }