Esempio n. 1
0
        public void LoadEntry(JournalEntry entry)
        {
            currentEntry = entry;

            textBox_EditTitle.Text = entry.Title;

            textBox_EditEntry.Text = entry.Entry;

            datePicker_EntryDate.SelectedDate = entry.EntryDate;
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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();
        }