private void CloseDialog(NavigateResultControlViewModel.DialogClosingEventArgs.ClosingActions action)
 {
     lock (viewModel)
     {
         countdownThread = null;
         this.viewModel.NotifyDialogClosed(action);
         System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             Hide();
         });
     }
 }
        private void CloseDialog(NavigateResultControlViewModel.DialogClosingEventArgs.ClosingActions action)
        {
            //Report statistics:
            string actionString = action.ToString();
            string actionName = actionString.Substring(actionString.LastIndexOf(".") + 1);
            WebStats.ReportWebStatEventAsync(actionName);

            lock (viewModel)
            {
                countdownThread = null;
                this.viewModel.NotifyDialogClosed(action);
                System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    Hide();
                });
            }
        }
        public void Show(NavigateResultControlViewModel viewModel)
        {
            // Set the data context
            this.viewModel = viewModel;
            this.DataContext = this.viewModel;

            // Update the language
            LanguageResources.Instance.UpdateControl(this);

            // And now add to the current page (we only allow to add this to the main page
            var currentPage = ((App)Application.Current).RootFrame.Content as WazeApplicationPage;
            if (currentPage != null)
            {
                currentPage.GetPopupPanel().Children.Add(this);

                // Finally - start the thread to update the button text (and close the dialog)
                StartCountdownThread();
            }
        }
Esempio n. 4
0
        public void Show(NavigateResultControlViewModel viewModel)
        {
            // Set the data context
            this.viewModel   = viewModel;
            this.DataContext = this.viewModel;

            // Update the language
            LanguageResources.Instance.UpdateControl(this);

            // And now add to the current page (we only allow to add this to the main page
            var currentPage = ((App)Application.Current).RootFrame.Content as WazeApplicationPage;

            if (currentPage != null)
            {
                currentPage.GetPopupPanel().Children.Add(this);

                // Finally - start the thread to update the button text (and close the dialog)
                StartCountdownThread();
            }
        }
Esempio n. 5
0
    public static void NOPH_NavigateResultDialog_showDialog(int navigate_flags, 
                                                            int i_title_text, int i_route_distance, int i_route_distance_units, 
                                                            int route_length, int i_via, int timeout, int show_diclaimer, 
                                                            int drive_callback, int alternative_routes_callback)
    {
        // Convert the input
        bool changedDeparture = ((navigate_flags & CHANGED_DEPARTURE) != 0);
        bool changedDestination = ((navigate_flags & CHANGED_DESTINATION) != 0);
        string title = CRunTime.charPtrToString(i_title_text);
        string routeDistance = CRunTime.charPtrToString(i_route_distance);
        string routeDistanceUnits = CRunTime.charPtrToString(i_route_distance_units);
        string via = CRunTime.charPtrToString(i_via);
        bool showDisclaimer = (show_diclaimer != 0);

        // Create the view model
        NavigateResultControlViewModel viewModel = new NavigateResultControlViewModel(changedDestination, changedDeparture,
                                                                                      title, routeDistance, routeDistanceUnits,
                                                                                      route_length, via, timeout, showDisclaimer);
        viewModel.OnDialogClosed += (sender, args) =>
        {
            System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                if (args.SelectedAction == NavigateResultControlViewModel.DialogClosingEventArgs.ClosingActions.Drive)
                {
                    UIWorker.addUIEvent(drive_callback, 0, 0, 0, 0, true);
                }
                else // NavigateResultControlViewModel.DialogClosingEventArgs.ClosingActions.Alternatives
                {
                    UIWorker.addUIEvent(alternative_routes_callback, 0, 0, 0, 0, true);
                }

                DialogIsOn = false;
            });
        };

        // And show the dialog
        System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
        {
            var dialog = new NavigateResultControl();
            DialogIsOn = true;
            dialog.Show(viewModel);
        });
    }