private async Task <Alarm> NewAlarm() { Alarm createdAlarm = await this.CreateAlarm(); // insert the alarm into the database StoredProcedures.CreateAlarm(createdAlarm.Title, createdAlarm.ActivateDateAndTime); string mainPart = $"Alright, alarm set for "; string datePart = createdAlarm.ActivateDateAndTime.ToString("MMM d"); string timePart = createdAlarm.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(createdAlarm); }
private void SubmitAlarmButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { if (this.ValidateForm()) { this.PopulateAlarmFromForm(); if (this.AlarmToEdit.AlarmID == -1) { StoredProcedures.CreateAlarm(this.AlarmToEdit.Title, this.AlarmToEdit.ActivateDateAndTime); } else { StoredProcedures.UpdateAlarm(this.AlarmToEdit.AlarmID, this.AlarmToEdit.Title, this.AlarmToEdit.ActivateDateAndTime, false); } UIUtils.GoBack(this, typeof(AlarmsPage)); } }
private Alarm NewAlarm() { this.ClearArea(); Alarm createdAlarm = this.CreateAlarm(); // the alarm can be null if the user did not provide a date if (createdAlarm != null) { // insert the alarm into the database StoredProcedures.CreateAlarm(createdAlarm.Title, createdAlarm.ActivateDateAndTime); // schedule a toast notification for the alarm AlarmAndReminderHelper.ScheduleAlarm(StoredProcedures.QueryLatestAlarm()); string mainPart = $"Alright, alarm set for "; string datePart = createdAlarm.ActivateDateAndTime.ToString("MMM d"); string timePart = createdAlarm.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(createdAlarm); }