private void ViewNote(object sender, RoutedEventArgs e)
        {
            var  title    = sender as ListBox;
            var  noteDict = title.SelectedItem as Dictionary <string, int>;
            var  tuple    = titleDict.ElementAt(title.SelectedIndex);
            int  noteId   = tuple.Value;
            Note note     = repo.GetNoteById(noteId);
            var  v        = new ViewNote(note);

            v.Show();
        }
Beispiel #2
0
        private void Save_Note_Changes(object sender, RoutedEventArgs e)
        {
            Note edited = repo.GetNoteById(noteInput.NoteId);

            edited.Title      = TitleBox.Text;
            edited.Content    = ContentBox.Text;
            edited.CategoryId = (int)CatCombo.SelectedValue;
            repo.SaveChanges();
            if (oldTitle != edited.Title)
            {
                MainWindow.titleDict.Add(TitleBox.Text, noteInput.NoteId);
                MainWindow.titleDict.Remove(oldTitle);
            }
            ViewNote v = new ViewNote(repo.GetNoteById(noteInput.NoteId));

            v.Show();
            this.Close();
        }