public async Task GetSchedule()
        {
            if (!CrossConnectivity.Current.IsConnected)
            {
                // Optionally, you can show a warning saying 
                // the client is not connected
                return;
            }

            try
            {
                var client = new ServiceClient();
                var schedule = await client.GetScheduleForCity(_cityId);

                if (schedule != null)
                {
                    await Task.Run(() => from slot in schedule.Slots
                                         orderby slot.StartTime
                                         group slot by slot.DayFormatted
                        into slotGroup
                                         select new Grouping<string, Slot>(slotGroup.Key, slotGroup)).ContinueWith(r =>
                                     {
                                         GroupedSlots = new ObservableCollection<Grouping<string, Slot>>(r.Result);
                                     });
                }
            }
            catch (Exception)
            {
                ServiceError = true;
            }
        }
Exemplo n.º 2
0
 private async Task<List<City>> GetRemoteCitiesAsync()
 {
     var client = new ServiceClient();
     var cities = await client.GetCities();
     return cities;
 }