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 }); }
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(); } }
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; } }
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() ); }
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; } }
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); }
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)); }
private void SearchList_RouteGroupSelected(object sender, RouteGroup selected) { Frame.Navigate(typeof(TimetablePage), new TimetableParameter { Route = UserEstimations.BestRoute(selected) }); }