protected override void OnNavigatedFrom(NavigationEventArgs e) { if (_visitMonitor != null) { _visitMonitor.Stop(); _visitMonitor.VisitStateChanged -= OnVisitStateChanged; } }
/// <summary> /// This is the click handler for the 'StopMonitoring' button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void StopMonitoring(object sender, RoutedEventArgs e) { // Stop visit monitoring. _visitMonitor.Stop(); _visitMonitor = null; StartMonitoringButton.IsEnabled = true; StopMonitoringButton.IsEnabled = false; // Clear status _rootPage.NotifyUser("", NotifyType.StatusMessage); }
/// <summary> /// Invoked immediately before the Page is unloaded and is no longer the current source of a parent Frame. /// </summary> /// <param name="e"> /// Event data that can be examined by overriding code. The event data is representative /// of the navigation that will unload the current Page unless canceled. The /// navigation can potentially be canceled by setting e.Cancel to true. /// </param> protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { _visitMonitor?.Stop(); }