コード例 #1
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (!UnityApp.IsLocationEnabled())
            {
                return;
            }
            if (IsolatedStorageSettings.ApplicationSettings.Contains("LocationConsent"))
            {
                _useLocation = (bool)IsolatedStorageSettings.ApplicationSettings["LocationConsent"];
            }
            else
            {
                MessageBoxResult result = MessageBox.Show("Can this application use your location?",
                                                          "Location Services", MessageBoxButton.OKCancel);
                _useLocation = result == MessageBoxResult.OK;
                IsolatedStorageSettings.ApplicationSettings["LocationConsent"] = _useLocation;
                IsolatedStorageSettings.ApplicationSettings.Save();
            }
        }