public ActivateSensorCore()
        {
            InitializeComponent();

            var app = Application.Current as Places.App; // The application model

            sensorCoreActivationStatus = app.SensorCoreActivationStatus;
        }
Beispiel #2
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            this._navigationHelper.OnNavigatedTo(e);
            ActivateSensorCoreStatus status = _app.SensorCoreActivationStatus;

            if (e.NavigationMode == NavigationMode.Back && status.Ongoing)
            {
                status.Ongoing = false;

                if (status.ActivationRequestResult != ActivationRequestResults.AllEnabled)
                {
                    var           loader = new ResourceLoader();
                    MessageDialog dialog = new MessageDialog(loader.GetString("NoLocationOrMotionDataError/Text"), loader.GetString("Information/Text"));
                    dialog.Commands.Add(new UICommand(loader.GetString("OkButton/Text")));
                    await dialog.ShowAsync();

                    new System.Threading.ManualResetEvent(false).WaitOne(500);
                    Application.Current.Exit();
                }
            }

            InitCore();
        }