コード例 #1
0
ファイル: PanoVM.cs プロジェクト: pdz8/ms13apphack
 public void UpdateSuggestions()
 {
     Suggestions.Clear();
     TransitInfo.RefreshRouteIDs();
     foreach (string k in TransitInfo.RouteIDs.Keys)
     {
         Suggestions.Add(k);
     }
 }
コード例 #2
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            // Update current dispatcher
            Util.CurrentDispatcher = this.Dispatcher;

            if (this.startup)
            {
                // Initialize progress bar
                this.InitializeProgress();

                // Setup ViewModel
                string route_id;
                string route_name;
                if (this.NavigationContext.QueryString.TryGetValue("route_id", out route_id))
                {
                    this.ViewModel = new StopResultVM(AppSettings.KnownRoutes.Value[route_id]);
                    await InitializeFromViewModel();
                }
                else if (this.NavigationContext.QueryString.TryGetValue(VoiceHelper.RouteNumPhraseList, out route_name))
                {
                    ProgressIndicatorHelper.Instance.Push(LoadingEnum.Routes);
                    BusRoute br = await TransitInfo.SearchForRoute(route_name);

                    ProgressIndicatorHelper.Instance.Remove(LoadingEnum.Routes);
                    if (LocationTracker.GetPermission())
                    {
                        LocationTracker.RetrieveLocation();
                    }
                    if (br != null)
                    {
                        this.ViewModel = new StopResultVM(br);
                        await InitializeFromViewModel();
                    }
                    else
                    {
                        MessageBox.Show(string.Format("Could not find route {0}.", route_name),
                                        "No matches", MessageBoxButton.OK);
                    }
                }
            }
        }
コード例 #3
0
ファイル: PanoPage.xaml.cs プロジェクト: pdz8/ms13apphack
        /// <summary>
        /// Search the text in the route box
        /// </summary>
        /// <returns></returns>
        private async Task SearchRoutes()
        {
            this.Focus();

            // Blank route
            if (this.RouteSearchBox.Text == EmptyTextBox ||
                string.IsNullOrWhiteSpace(this.RouteSearchBox.Text))
            {
                MessageBox.Show("Please enter the number of a bus route in your area.",
                                "No input", MessageBoxButton.OK);
                return;
            }

            ProgressIndicatorHelper.Instance.Push(LoadingEnum.Routes);
            BusRoute br = await TransitInfo.SearchForRoute(this.RouteSearchBox.Text);

            if (br == null && !AppSettings.LocationConsent.Value && LocationTracker.GetPermission())
            {
                br = await TransitInfo.SearchForRoute(this.RouteSearchBox.Text);
            }
            ProgressIndicatorHelper.Instance.Remove(LoadingEnum.Routes);
            if (br == null)
            {
                TransitLoader.InternetAvailable();
                MessageBox.Show(string.Format("Could not find route {0}.", this.RouteSearchBox.Text),
                                "No matches", MessageBoxButton.OK);
                return;
            }

            this.RouteSearchBox.Text = "";
            if (this.SpacingPanel.Height == spacerMaxHeight)
            {
                this.SetSearchBarVisibility(Visibility.Collapsed);
            }
            NavigationService.Navigate(new Uri(
                                           string.Format("/Pages/StopResultPage.xaml?route_id={0}", br.Id),
                                           UriKind.Relative));
            //NavigationService.Navigate(new Uri("/Pages/StopResultPage.xaml", UriKind.Relative));
        }