private void MainWindowViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(FinalContent): string pageName = FinalContent.GetPageName(); PageViewTelemetryHelper.TrackPageVisited(pageName); break; } }
public async Task HandleBeingReturnedTo() { // Update the time left at just like when we're left, since on iOS in certain cases // returned to gets called when being left didn't get called, so it permanently thinks // we left the app a long time ago otherwise var timeLeftAt = _timeLeftAt; _timeLeftAt = DateTime.Now; // If the day has changed (went from yesterday to today), reset the entire view model if (timeLeftAt.Date != DateTime.Now.Date || AccountDataStore.RetrieveAndResetWasUpdatedByBackgroundTask()) { await HandleNormalLaunchActivation(); return; } // If it's been gone for more than a minute, do a sync if (DateTime.Now.AddMinutes(-1) > timeLeftAt) { try { if (CurrentAccount != null) { try { var dontWait = SyncLayer.Sync.SyncAccountAsync(CurrentAccount); } catch { } } } catch { } } try { if (RemindersExtension.Current != null && CurrentAccount != null) { var dontWait = RemindersExtension.Current.ClearCurrentReminders(CurrentAccount.LocalAccountId); } } catch (Exception ex) { TelemetryExtension.Current?.TrackException(ex); } PageViewTelemetryHelper.TrackReturningToApp(); }
public void HandleBeingLeft() { _timeLeftAt = DateTime.Now; PageViewTelemetryHelper.TrackLeavingApp(); }