예제 #1
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            this.SupportedOrientations = GamePage.get().SupportedOrientations;

            // Set the page's state according to the context
            if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
            {
                this.ViewModel   = NavigationContext.GetData <AlternativeRoutesPageViewModel>();
                this.DataContext = this.ViewModel;

                // And translate the page
                LanguageResources.Instance.UpdateControl(this);
            }
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            this.SupportedOrientations = GamePage.get().SupportedOrientations;

            // Set the page's state according to the context
            if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
            {
                this.ViewModel = NavigationContext.GetData<AlternativeRoutesPageViewModel>();
                this.DataContext = this.ViewModel;

                // And translate the page
                LanguageResources.Instance.UpdateControl(this);
            }
        }
예제 #3
0
파일: Syscalls.cs 프로젝트: ckeboss/WazeWP7
    public static void NOPH_AlternativeResultsDialog_showDialog(int number_of_routes, int routes, int dialog_closed_callback, int route_option_selected_callback)
    {
        var viewModel = new AlternativeRoutesPageViewModel();

        // Read all the routes from the memory
        int recordPointer = routes;
        for (int i = 0; i < number_of_routes; i++)
        {
            viewModel.AlternativeRoutes.Add(ReadAlternativeRouteFromMemory(ref recordPointer));
        }

        // Set the callback
        viewModel.OnDialogClosed += (sender, args) =>
        {
            System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                UIWorker.addUIEvent(dialog_closed_callback, 1, 0, 0, 0, true);
            });
        };
        viewModel.OnOptionSelected += (sender, args) =>
        {
            System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                UIWorker.addUIEvent(route_option_selected_callback, (int)(args.SelectedOption), args.ContextAddress, 0, 0, true);
            });
        };

        // And navigate the the page
        System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
        {
            var currentPage = ((App)Application.Current).RootFrame.Content as PhoneApplicationPage;
            currentPage.NavigationService.Navigate<AlternativeRoutesPage>(viewModel);
        });
    }
        private void OptionSelected(AlternativeRoutesPageViewModel.OptionSelectedEventArgs.Options selectedOption)
        {
            //Report statistics:
            string optionString = selectedOption.ToString();
            string optionName = optionString.Substring(optionString.LastIndexOf(".") + 1);
            WebStats.ReportWebStatEventDetailsAsync("AlternativeRoutes", optionName);

            ViewModel.NotifyOptionSelected(selectedOption, (currentItem == null) ? 0 : currentItem.ContextPointer);
            if (selectedOption != AlternativeRoutesPageViewModel.OptionSelectedEventArgs.Options.Cancel)
            {
                NavigateBackHome();
            }
        }