Esempio n. 1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // if there isn't a parse user in session, or we have a user saved in isolated storage, go straight to news feed
            if (ParseUser.CurrentUser != null)
            {
                NavigationService.Navigate(new Uri("/Pages/NewsFeed.xaml?FromLogin=true", UriKind.Relative));
            }

            // CHECK FOR PREVIOUS EXCEPTION:
            ErrorReporting.CheckForPreviousException();
        }
Esempio n. 2
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            // make sure user has agreed to let this app use their location, and that
            // their location settings are turned on!
            bool locationSettingsVerified = UserSettings.CheckLocationConsentAndSettings();

            // CHECK FOR PREVIOUS EXCEPTION:
            ErrorReporting.CheckForPreviousException();

            btnMapRoute.IsEnabled   = locationSettingsVerified;
            btnQuickCheck.IsEnabled = locationSettingsVerified;

            // reset:
            App.Geolocator = null;
        }
Esempio n. 3
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (e.NavigationMode == NavigationMode.New)
            {
                ErrorReporting.CheckForPreviousException(true);
                AppMetadata.CheckForNewVersion();
            }

            // settings changed
            if (lastEmail != null && lastEmail != Settings.GetString(Setting.Email))
            {
                ErrorReporting.Log("Settings changed");
                activeCourses.ItemsSource   = null;
                upcomingCourses.ItemsSource = null;
                finishedCourses.ItemsSource = null;
            }

            var email    = Settings.GetString(Setting.Email);
            var password = Settings.GetString(Setting.Password);

            lastEmail = email;

            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
            {
                if (e.NavigationMode != NavigationMode.Back)
                {
                    this.NavigateToSettings();
                }
                else
                {
                    messageTextBlock.Text       = "Please set your email and password in the Settings.";
                    messageTextBlock.Visibility = Visibility.Visible;
                }
            }
            else if (activeCourses.ItemsSource == null)
            {
                LoadCourses(email, password, false);
            }
        }
Esempio n. 4
0
 public void OnException(string message, Exception e)
 {
     ErrorReporting.ReportException(e, message);
     ErrorReporting.CheckForPreviousException(false);
 }
Esempio n. 5
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            fromStation    = NavigationContext.QueryString.ContainsKey("fromStation") ? Stations.Get(NavigationContext.QueryString["fromStation"]) : null;
            excludeStation = NavigationContext.QueryString.ContainsKey("excludeStation") ? NavigationContext.QueryString["excludeStation"] : null;

            if (fromStation == null)
            {
                if (e.NavigationMode == NavigationMode.New)
                {
                    if (Stations.Country == Country.UK)
                    {
                        Task.Run(() => InstallVoiceCommands());
                    }

                    ErrorReporting.CheckForPreviousException(true);
                    AppMetadata.CheckForNewVersion();
                    if (!Settings.GetBool(Setting.LocationServicesEnabled) && !Settings.GetBool(Setting.LocationServicesPromptShown))
                    {
                        Settings.Set(Setting.LocationServicesPromptShown, true);
                        if (Extensions.ShowMessageBox("Location Services", "This application uses your current location to improve the experience. Do you wish to give it permission to use your location?",
                                                      "Use location", "No thanks"))
                        {
                            Settings.Set(Setting.LocationServicesEnabled, true);
                        }
                    }
                }
            }
            else
            {
                pivot.Title    = fromStation.Name + " calling at";
                nearest.Header = "Near " + fromStation.Name;
            }

            var removeBackEntry = NavigationContext.QueryString.ContainsKey("removeBackEntry");

            if (removeBackEntry)
            {
                NavigationService.RemoveBackEntry();
            }

            LocationService.PositionChanged += LoadNearestStations;
            LoadNearestStations();

            RefreshRecentItemsList();

            if (NavigationContext.QueryString.ContainsKey("initialFilter"))
            {
                filter.Text         = NavigationContext.QueryString["initialFilter"];
                pivot.SelectedIndex = 2;
            }
            else if (hasRecentItemsToDisplay)
            {
                pivot.SelectedIndex = 1;
            }
            else if (fromStation == null && Settings.GetBool(Setting.LocationServicesEnabled))
            {
                pivot.SelectedIndex = 0;
            }
            else
            {
                pivot.SelectedIndex = 2;
            }
        }
Esempio n. 6
0
 void ContentPanel_Loaded(object sender, RoutedEventArgs e)
 {
     // CHECK FOR PREVIOUS EXCEPTION:
     ErrorReporting.CheckForPreviousException();
 }