public async override void OnNavigatedTo(NavigationEventArgs args)
        {
            base.OnNavigatedTo(args);
            Messenger.Register(this, new Action <OutlookCacheUpdatedEvent>(e => Dispatcher.CurrentDispatcher.Invoke(() =>
            {
                PrimaryMeeting   = OutlookCachingService.GetCachedMeetings().GetBestMeeting();
                OutlookException = OutlookCachingService.OutlookException;
                IsBusy           = false;
            })));

            await Task.Delay(100);

            await RefreshMeetingsAsync();

            _refreshTimer.Start();
        }
Exemple #2
0
        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.");
            }
        }
        private void OutlookCacheUpdatedEventHandler(OutlookCacheUpdatedEvent args)
        {
            var jumpList = JumpList.GetJumpList(Application.Current) ?? new JumpList();

            JumpList.SetJumpList(Application.Current, jumpList);

            var allTasks = jumpList.GetJumpTasks().ToList();

            //if (!allTasks.Any(t => t.Arguments == "/quickjoin"))
            //    jumpList.Add("Instantly Join Meeting", "Quick Actions", "/quickjoin");

            allTasks.Where(t => t.CustomCategory == "Outlook Calendar").ToList().ForEach(t => jumpList.Remove(t.Arguments));
            OutlookCachingService.GetCachedMeetings()
            .ToList()
            .ForEach(oi => jumpList
                     .Add(String.Format("{0} ({1})", oi.Subject, oi.Start.ToShortTimeString()),
                          "Outlook Calendar",
                          "/join:" + oi.LyncMeeting.OriginalUri));
            jumpList.Apply();
        }
 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;
 }
Exemple #5
0
 private void OutlookCacheUpdatedEventHandler(OutlookCacheUpdatedEvent args)
 {
     Events           = new ObservableCollection <OutlookItem>(OutlookCachingService.GetCachedMeetings(requireOnlineMeeting: !ShowAll));
     OutlookException = OutlookCachingService.OutlookException;
 }