/// <summary> /// Called when a page is no longer the active page in a frame. /// </summary> /// <param name="e">Event arguments</param> protected async override void OnNavigatingFrom(NavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); if (_recordingTimer != null) { _recordingTimer.Stop(); } if (_pMonitor != null) { await _pMonitor.DeactivateAsync(); } if (_sCounter != null) { await _sCounter.DeactivateAsync(); } if (_rTracker != null) { await _rTracker.DeactivateAsync(); } if (_aMonitor != null) { await _aMonitor.DeactivateAsync(); } _activityRecording.Recorder = null; _placesRecording.Recorder = null; _stepsRecording.Recorder = null; _routeRecording.Recorder = null; }
/// <summary> /// constructor /// </summary> public MainPage() { this.InitializeComponent(); this.NavigationCacheMode = NavigationCacheMode.Required; Window.Current.VisibilityChanged += async(oo, ee) => { if (!ee.Visible && _trackMonitor != null) { await CallSenseApiAsync(async() => { await _trackMonitor.DeactivateAsync(); }); } else if (_trackMonitor != null) { await CallSenseApiAsync(async() => { await _trackMonitor.ActivateAsync(); }); UpdateScreenAsync(); } }; }