public void LoadEntry(JournalEntry entry) { currentEntry = entry; textBox_EditTitle.Text = entry.Title; textBox_EditEntry.Text = entry.Entry; datePicker_EntryDate.SelectedDate = entry.EntryDate; }
private void button_Publish_Click(object sender, RoutedEventArgs e) { string title = textBox_Title.Text; string entry = textBox_Entry.Text; DateTime currentDate = DateTime.Now; JournalEntry newEntry = new JournalEntry(); newEntry.Id = currentJournal.Entries.Count + 1; newEntry.Title = title; newEntry.Entry = entry; newEntry.EntryDate = currentDate; currentJournal.Entries.Add(newEntry); }
private void button_SaveChanges_Click(object sender, RoutedEventArgs e) { // validation string title = textBox_EditTitle.Text; string entry = textBox_EditEntry.Text; JournalEntry editEntry = new JournalEntry(); currentEntry.EntryDate = datePicker_EntryDate.SelectedDate.GetValueOrDefault(DateTime.Now); currentEntry.Title = title; currentEntry.Entry = entry; var mainWindow = (MainWindow)Owner; mainWindow.RefreshGrid(); Close(); }