Пример #1
0
        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;
            }
        }
Пример #2
0
        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;
            }
        }
Пример #3
0
        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;
            }
        }
Пример #4
0
        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;
            }
        }
Пример #5
0
        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;
            }
        }
Пример #6
0
        private async Task ExecuteLoadRoutesCommand()
        {
            if (IsBusy)
            {
                return;
            }
            IsBusy = true;

            RoutesCollection.Clear();
            await LoadRoutes();

            foreach (var route in Routes)
            {
                RoutesCollection.Add(route);
            }

            IsBusy = false;
        }
Пример #7
0
        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);
                }
            }
        }