Ejemplo n.º 1
0
 private void SubmitReminderButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     if (this.ValidateForm())
     {
         this.PopulateReminderFromForm();
         if (this.ReminderToEdit.ReminderID == -1)
         {
             StoredProcedures.CreateReminder(this.ReminderToEdit.Title, this.ReminderToEdit.ActivateDateAndTime, this.ReminderToEdit.Description);
             // schedule the notification for it
             AlarmAndReminderHelper.ScheduleReminder(StoredProcedures.QueryLatestReminder());
         }
         else
         {
             StoredProcedures.UpdateReminder(this.ReminderToEdit.ReminderID, this.ReminderToEdit.Title, this.ReminderToEdit.ActivateDateAndTime, this.ReminderToEdit.Description, false);
             // reschedule the reminder
             AlarmAndReminderHelper.RescheduleReminder(this.ReminderToEdit);
         }
         UIUtils.GoBack(this, typeof(RemindersPage));
     }
 }
Ejemplo n.º 2
0
        private async Task <Reminder> NewReminderAsync()
        {
            Reminder createdReminder = await this.CreateReminderAsync();

            // if the reminder is null, then don't do anything
            if (createdReminder != null)
            {
                // insert the reminder into the database
                StoredProcedures.CreateReminder(createdReminder.Title, createdReminder.ActivateDateAndTime, createdReminder.Description);
                // schedule a toast notification for the reminder
                AlarmAndReminderHelper.ScheduleReminder(StoredProcedures.QueryLatestReminder());
                string mainPart    = $"Alright, reminder set for ";
                string datePart    = createdReminder.ActivateDateAndTime.ToString("MMM d");
                string timePart    = createdReminder.ActivateDateAndTime.ToString("h:mm tt");
                string rawSSML     = new SSMLBuilder().Add(mainPart).SayAs(datePart, SSMLBuilder.SayAsTypes.DATE).Add(" at ").SayAs(timePart, SSMLBuilder.SayAsTypes.TIME).BuildWithoutWrapperElement();
                string prosodySSML = new SSMLBuilder().Prosody(rawSSML, pitch: "+5%", contour: "(10%,+5%) (50%,-5%) (80%,-5%)").Build();
                TextToSpeechEngine.SpeakInflectedText(this.MediaElement, prosodySSML);
            }

            return(createdReminder);
        }