private async Task ExecuteLoadRoutesCommand() { if (IsBusy) { return; } IsBusy = true; try { RoutesCollection.Clear(); await LoadRoutes(); foreach (var route in Routes) { RoutesCollection.Add(route); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { RoutesCollection.Clear(); var routes = await RoutesDayDataStore.GetItemsAsync(true); foreach (RouteDay routeDay in routes) { RoutesCollection.Add(routeDay); } } catch (Exception ex) { Debug.WriteLine(ex); await App.Current.MainPage.DisplayAlert("Błąd", "Coś poszło nie tak", "OK"); } finally { IsBusy = false; } }
private async Task ExecuteLoadSchedulesCommand() { if (IsBusy) { return; } IsBusy = true; try { RoutesCollection.Clear(); await LoadRoutes(); foreach (var route in Routes) { RoutesCollection.Add(route); } await SetSelectedRoute(Routes.First()); RenderSchedulesGrid(); } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
void LoadRoutes() { if (IsBusy) { return; } IsBusy = true; try { RoutesCollection.Clear(); var routes = RouteDay.routes; foreach (Route route in routes) { RoutesCollection.Add(route); } } catch (Exception ex) { Debug.WriteLine(ex); App.Current.MainPage.DisplayAlert("Błąd", "Coś poszło nie tak", "OK"); } finally { IsBusy = false; } }
async Task ExecuteLoadDelaysCommand() { if (IsBusy) { return; } IsBusy = true; try { RoutesCollection.Clear(); var routes = await RouteDataStore.GetItemsAsync(true); foreach (Route route in routes) { RoutesCollection.Add(route); } DelaysCollection.Clear(); var delays = await StopDelaysDataStore.GetItemsAsync(int.Parse(Stop.StopId), true); foreach (Delay delay in delays) { DelaysCollection.Add(delay); } foreach (Delay delay in DelaysCollection) { foreach (Route route in RoutesCollection) { if (int.Parse(delay.RouteId) == route.RouteId) { delay.RouteLongName = route.RouteLongName; delay.RouteShortName = route.RouteShortName; } } } if (DelaysCollection.Count == 0) { await App.Current.MainPage.DisplayAlert("", "Brak przyjazdów w najbliższym czasie", "OK"); } } catch (Exception ex) { Debug.WriteLine(ex); await App.Current.MainPage.DisplayAlert("Błąd", "Coś poszło nie tak", "OK"); } finally { IsBusy = false; } }
private async Task ExecuteLoadRoutesCommand() { if (IsBusy) { return; } IsBusy = true; RoutesCollection.Clear(); await LoadRoutes(); foreach (var route in Routes) { RoutesCollection.Add(route); } IsBusy = false; }
public void SearchCommandExecute(string SearchedText) { var Backup = RoutesBackupCollection; var tempRecords = Backup.Where(c => (c.RouteShortName.IndexOf(SearchedText, StringComparison.OrdinalIgnoreCase) >= 0) || (c.RouteLongName.IndexOf(SearchedText, StringComparison.OrdinalIgnoreCase) >= 0)); RoutesCollection.Clear(); foreach (var item in tempRecords) { RoutesCollection.Add(item); } if (RoutesCollection.Count == 0) { foreach (var item in Backup) { RoutesCollection.Add(item); } } }