Exemplo n.º 1
0
 private void ReloadTable(TimeSlotSource Source)
 {
     InvokeOnMainThread(() => {
         TableView.Source = Source;
         TableView.ReloadData();
         ProgressRing.StopAnimating();
         ProgressRing.Hidden = true;
     });
 }
Exemplo n.º 2
0
 private void StopLoadState()
 {
     ProgressRing.StopAnimating();
     ProgressRing.Hidden = true;
 }
Exemplo n.º 3
0
        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;
                    }
                }
            }
        }