private void AddEvent()
        {
            EventViewModel evm = new EventViewModel();

            if (SelectedItem == null)
            {
                evm.DateYear  = DateTime.Now.Year;
                evm.DateMonth = DateTime.Now.Month;
                evm.DateDay   = DateTime.Now.Day;
            }
            else
            {
                evm.DateYear  = SelectedItem.Year;
                evm.DateMonth = SelectedItem.Month;
                evm.DateDay   = SelectedItem.DayInMonth;
            }
            EventWindow window = new EventWindow()
            {
                DataContext = evm
            };

            evm.OnRequestClose += (s, e) => window.Close();

            window.ShowDialog();
        }
Exemplo n.º 2
0
        private void CreateEvent(object sender, RoutedEventArgs e)
        {
            EventWindow eventWindow = new EventWindow
            {
                Owner = ((MainWindow)Application.Current.MainWindow)
            };

            if (true == eventWindow.ShowDialog())
            {
                this.fetchData();
            }
        }
        public bool AddButton_Click()
        {
            EventModel  newModel;
            EventWindow addEventWindow = new EventWindow();

            if (addEventWindow.ShowDialog(out newModel) == true)
            {
                EventDB.insert(newModel);
                Console.WriteLine("newModel inserted to LiteDB");
                return(true);
            }
            return(false);
        }
Exemplo n.º 4
0
 private void EditEvent(object sender, RoutedEventArgs e)
 {
     if (EventListBox.SelectedItem != null)
     {
         EventWindow eventWindow = new EventWindow((Models.Event)EventListBox.SelectedItem)
         {
             Owner = ((MainWindow)Application.Current.MainWindow)
         };
         if (true == eventWindow.ShowDialog())
         {
             this.fetchData();
         }
     }
 }
Exemplo n.º 5
0
        public bool EditButton_Click()
        {
            EventModel  newModel;
            EventWindow editEventWindow = new EventWindow(eventModel);

            if (editEventWindow.ShowDialog(out newModel) == true)
            {
                eventModel.Subject             = newModel.Subject;
                eventModel.EmailToRecall       = newModel.EmailToRecall;
                eventModel.StartDateTime       = newModel.StartDateTime;
                eventModel.Description         = newModel.Description;
                eventModel.EmailSentSuccessful = newModel.EmailSentSuccessful;
                Refresh();
                EventDB.update(eventModel);
                Console.WriteLine("eventModel (Subject = " + eventModel.Subject + ") updated");
                return(true);
            }
            return(false);
        }