Esempio n. 1
0
        protected virtual void EditAction()
        {
            ReminderEntity reminderToUpdate = SelectedReminder;

            if (reminderToUpdate == null)
            {
                ErrorDialogUtility.ErrorDialog(TranslationProvider.Tr("warningReminderNotSelectedToEdit"));
                return;
            }

            CreateAndUpdateReminderForm createReminderForm = new CreateAndUpdateReminderForm(PersistenceAdapter, reminderToUpdate);

            createReminderForm.ShowDialog();

            if (createReminderForm.DialogResult != DialogResult.OK)
            {
                Log.Logger.Information($"UpdateReminderForm closed with result NotOk.");
                return;
            }

            var updatedReminder = createReminderForm.CreateOrUpdatedReminder;

            bool result = PersistenceAdapter.Update(reminderToUpdate.Name, updatedReminder);

            if (result == true)
            {
                //using the element in the listbox
                remindersListBox.Items[remindersListBox.SelectedIndex] = updatedReminder;
            }
            else
            {
                ErrorDialogUtility.ErrorDialog(TranslationProvider.Tr("warningSnoozedReminderCannotModify"));
            }
        }
Esempio n. 2
0
        private void createReminderButton_Click(object sender, EventArgs e)
        {
            var createReminderForm = new CreateAndUpdateReminderForm(PersistenceAdapter);

            createReminderForm.ShowDialog();

            if (createReminderForm.DialogResult != DialogResult.OK)
            {
                Log.Logger.Information($"CreateReminderForm closed with result NotOk.");
                return;
            }

            var createdReminder = createReminderForm.CreateOrUpdatedReminder;

            PersistenceAdapter.Save(createdReminder);
        }