private void ReloadTable(TimeSlotSource Source) { InvokeOnMainThread(() => { TableView.Source = Source; TableView.ReloadData(); ProgressRing.StopAnimating(); ProgressRing.Hidden = true; }); }
private void StopLoadState() { ProgressRing.StopAnimating(); ProgressRing.Hidden = true; }
private async Task LoadScheduleAsync() { if (Schedule == null) { DataSource = new ScheduleDataSource(); Appointment a = ApplicationData.Current.NewAppointment; DataServiceResponse <ScheduleResults> response = await DataSource.GetAvailableTimes(StartDate, EndDate, a.BranchNumber, a.AppointmentType.Value, a.AppointmentSubType.Value, a.AppointmentLanguage); if (response.Success) { if (string.IsNullOrEmpty(response.Data.ErrorMessage)) { Schedule = response.Data; foreach (ScheduleResult r in Schedule.ScheduleDays) { if (r.ScheduleDate.Date.Equals(SelectedDay.Date)) { ReloadTable(new TimeSlotSource(r.TimeSlots)); break; } } InvokeOnMainThread(() => { ProgressRing.StopAnimating(); }); } else { //scheduling system error InvokeOnMainThread(() => { ProgressRing.StopAnimating(); var alert = UIAlertController.Create("Schedule Engine Error", $"{response.Data.ErrorMessage}", UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null)); PresentViewController(alert, true, null); }); } } else { //error InvokeOnMainThread(() => { ProgressRing.StopAnimating(); var alert = UIAlertController.Create("Error", $"Load Error: {response.ErrorMessage}", UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null)); PresentViewController(alert, true, null); }); } } else { foreach (ScheduleResult r in Schedule.ScheduleDays) { if (r.ScheduleDate.Date.Equals(SelectedDay.Date)) { ReloadTable(new TimeSlotSource(r.TimeSlots)); break; } } } }