private async void Save_Click(object sender, RoutedEventArgs e) { // Disable UI buttons, show loading bar if (IsNameValid() == false) { await new MessageDialog("The Task Name and Description must not be empty and ensure that you have selected a valid future date & time").ShowAsync(); return; } else { cancelButton.IsEnabled = false; saveButton.IsEnabled = false; tubelight.IsEnabled = false; coffeemachine.IsEnabled = false; buzzer.IsEnabled = false; goalNameTextBox.IsEnabled = false; goalDescriptionTextBox.IsEnabled = false; myDatePicker.IsEnabled = false; myTimePicker.IsEnabled = false; var sb = StatusBar.GetForCurrentView(); sb.ProgressIndicator.ProgressValue = null; sb.ProgressIndicator.Text = "Submitting to Azure..."; await sb.ProgressIndicator.ShowAsync(); // Getting bool flags // TODO. var ritual = new Ritual(); ritual.Description = goalDescriptionTextBox.Text; ritual.Name = goalNameTextBox.Text; // TimeSpan _gmt = new TimeSpan(5,30,0); ritual.EventDate = myDatePicker.Date.Date.Add(myTimePicker.Time); ritual.Tubelight = tubelight.IsChecked.Value; ritual.CoffeeMachine = coffeemachine.IsChecked.Value; ritual.Buzzer = buzzer.IsChecked.Value; bool res = await ServiceManager.TryInsertRitualAsync(ritualTable, ritual); // ritual.EventDate = myDatePicker.Date.Date.Add(myTimePicker.Time); if (res == true) { bool chck = await CalendarManager.TryWriteAppointmentAsync(ritual); if (chck == true) { await new MessageDialog("Appointment Set Sucessfully...").ShowAsync(); } else { await new MessageDialog("Error...Appointment Not Written To Calendar..").ShowAsync(); } } else { await new MessageDialog("Check Your Internet Connection!! Failed To Send To Cloud").ShowAsync(); PageManager.NavigateBack(); } cancelButton.IsEnabled = true; saveButton.IsEnabled = true; tubelight.IsEnabled = true; coffeemachine.IsEnabled = true; buzzer.IsEnabled = true; goalNameTextBox.IsEnabled = true; goalDescriptionTextBox.IsEnabled = true; myDatePicker.IsEnabled = true; myTimePicker.IsEnabled = true; await sb.ProgressIndicator.HideAsync(); sb = null; if (res == true) { PageManager.NavigateBack(); } } }