Пример #1
0
        private async void History_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var routeGroup = (sender as FrameworkElement).DataContext as RouteGroup;
            var route      = await UserEstimations.BestRouteAsync(routeGroup);

            var stop = await UserEstimations.BestStopAsync(route);

            Frame.Navigate(typeof(RoutePage), new TimetableParameter
            {
                Route = route,
                Stop  = stop
            });
        }
Пример #2
0
        private static async Task LoadBoxDefaultItemSourceTargets()
        {
            defaultItemSourceTargets = await Task.Run(() =>
            {
                var defaultTargetStops = new HashSet <StopGroup>(UserEstimations.GetPlanningHistory(false));
                return(boxItemSource.Where(model => defaultTargetStops.Contains(model.Value)).ToList());
            });

            if (!defaultItemSourceTargetsTask.IsCompleted)
            {
                defaultItemSourceTargetsTask.Start();
            }
        }
Пример #3
0
        private async void RecentList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (RecentList.SelectedItem != null)
            {
                await Task.Delay(100);

                RouteGroup selected = RecentList.SelectedItem as RouteGroup;
                Route      route    = UserEstimations.BestRoute(selected);
                StopGroup  stop     = UserEstimations.BestStop(route);
                MainPage.Current.NavigationService.Navigate(new Uri("/TimeTablePage.xaml?stopID=" + stop.ID + "&routeID=" + route.ID, UriKind.Relative));
                //MainPage.NavigateToRouteStop(MainPage.Current, route, stop);
                RecentList.SelectedItem = null;
            }
        }
Пример #4
0
 private static void Model_Loaded(object sender, EventArgs e)
 {
     boxItemSourceTask = Task.Run(
         () => App.Model.StopGroups.Select(x => new StopModel(x)).ToList()
         );
     defaultItemSourceTaskSources = Task.Run(
         () => UserEstimations.GetPlanningHistory(true)
         .Select(stop => new StopModel(stop))
         .ToList()
         );
     defaultItemSourceTaskTargets = Task.Run(
         () => UserEstimations.GetPlanningHistory(false)
         .Select(stop => new StopModel(stop))
         .ToList()
         );
 }
Пример #5
0
        private async void RecentList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (RecentList.SelectedItem != null)
            {
                await Task.Delay(100);

                RouteGroup selected = RecentList.SelectedItem as RouteGroup;
                Route      route    = UserEstimations.BestRoute(selected);
                StopGroup  stop     = UserEstimations.BestStop(route);
                if (RecentSelected != null)
                {
                    RecentSelected(this, new TimetableParameter {
                        Route = route, Stop = stop
                    });
                }

                RecentList.SelectedItem = null;
            }
        }
Пример #6
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            token = (DialogToken)e.Parameter;

            this.routeGroup = token.OriginalRoute.RouteGroup;
            this.routes     = routeGroup.Routes.ToList();
            this.stop       = token.OriginalStop;
            this.routeIndex = routes.IndexOf(token.OriginalRoute);

            if (stop == null)
            {
                this.stop = await UserEstimations.BestStopAsync(token.OriginalRoute);
            }

            DataContext   = this;
            TextName.Text = routeGroup.Description.Replace(" / ", "\n");

            setName();
            setContent();
            //Animations.FadeInFromBottomAfter(ContentListView, this, 25);
        }
Пример #7
0
        private void RouteGroupClicked(object sender, EventArgs e)
        {
            RouteGroup selected = sender as RouteGroup;

            MainPage.Current.NavigationService.Navigate(new Uri("/TimetablePage.xaml?routeID=" + UserEstimations.BestRoute(selected).ID, UriKind.Relative));
        }
Пример #8
0
 private void SearchList_RouteGroupSelected(object sender, RouteGroup selected)
 {
     Frame.Navigate(typeof(TimetablePage), new TimetableParameter {
         Route = UserEstimations.BestRoute(selected)
     });
 }