public async override void OnNavigatedTo(NavigationEventArgs args) { base.OnNavigatedTo(args); if (ApplicationSettings.Current.OutlookIntegration) { await OutlookCachingService.UpdateCacheIfNeededAsync(); Events = new ObservableCollection <OutlookItem>(OutlookCachingService.GetCachedMeetings(requireOnlineMeeting: !ShowAll)); OutlookException = OutlookCachingService.OutlookException; Messenger.Register(this, new Action <OutlookCacheUpdatedEvent>(e => Dispatcher.Invoke(() => OutlookCacheUpdatedEventHandler(e)))); } else { Events = null; OutlookException = new COMException("Outlook integration is not enabled."); } }
public async Task RefreshMeetingsAsync(bool forceRefresh = false) { IsBusy = true; if (ApplicationSettings.Current.OutlookIntegration) { if (forceRefresh) { await OutlookCachingService.UpdateCacheAsync(true); } else { await OutlookCachingService.UpdateCacheIfNeededAsync(); } PrimaryMeeting = OutlookCachingService.GetCachedMeetings().GetBestMeeting(); OutlookException = OutlookCachingService.OutlookException; } else { PrimaryMeeting = null; OutlookException = null; } IsBusy = false; }