예제 #1
0
 public static void AddMeeting(this JumpList jumpList, LyncMeeting meeting, string category = "Meetings")
 {
     jumpList.JumpItems.Add(new JumpTask()
     {
         ApplicationPath = System.Reflection.Assembly.GetExecutingAssembly()
                           .Location,
         Arguments        = "/join:" + meeting.OriginalUri,
         CustomCategory   = category,
         Title            = meeting.Description,
         WorkingDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly()
                                                            .Location)
     });
 }
        public MainWindowViewModel()
        {
            Messenger.Register(this, new Action <LaunchMeetingEvent>(LaunchMeetingEventHandler));
            Messenger.Register(this, new Action <OutlookCacheUpdatedEvent>(e => Dispatcher.Invoke(() => OutlookCacheUpdatedEventHandler(e))));

            var toJoin = ((App)Application.Current).Parameters.FirstOrDefault(p => p.StartsWith("/join:"));

            if (toJoin != null)
            {
                var meeting = LyncMeeting.ParseLyncMeeting(toJoin.Substring(6), string.Empty);
                if (meeting != null)
                {
                    Task.Run(() => Thread.Sleep(500)).ContinueWith(t => Messenger.Send(new LaunchMeetingEvent()
                    {
                        SipUrl = meeting.GetCraftyUri()
                    }), TaskScheduler.FromCurrentSynchronizationContext());
                }
            }
        }
예제 #3
0
        public bool SignalExternalCommandLineArgs(IList <string> args)
        {
            MainWindow.WindowState = WindowState.Normal;

            Parameters = args.ToList();
            var toJoin = Parameters.FirstOrDefault(p => p.StartsWith("/join:"));

            if (toJoin != null)
            {
                var meeting = LyncMeeting.ParseLyncMeeting(toJoin.Substring(6), string.Empty);
                if (meeting != null)
                {
                    Messenger.Default.Send(new LaunchMeetingEvent()
                    {
                        SipUrl = meeting.GetCraftyUri()
                    });
                }
            }

            return(true);
        }
예제 #4
0
 public static void RemoveMeeting(this JumpList jumpList, LyncMeeting meeting)
 {
     jumpList.JumpItems.RemoveAll(j => j is JumpTask && ((JumpTask)j).Arguments == meeting.OriginalUri);
 }
        public static void UpdateCache(bool resetException = false)
        {
            if (resetException)
            {
                OutlookException = null;
            }

            if (OutlookException != null)
            {
                return;
            }

            var events = new List <OutlookItem>();

            Microsoft.Office.Interop.Outlook.Application oApp                 = null;
            Microsoft.Office.Interop.Outlook.NameSpace   mapiNamespace        = null;
            Microsoft.Office.Interop.Outlook.MAPIFolder  calendarFolder       = null;
            Microsoft.Office.Interop.Outlook.Items       outlookCalendarItems = null;

            try
            {
                oApp                 = new Microsoft.Office.Interop.Outlook.Application();
                mapiNamespace        = oApp.GetNamespace("MAPI");
                calendarFolder       = mapiNamespace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);
                outlookCalendarItems = calendarFolder.Items;
                outlookCalendarItems.Sort("[Start]");
                outlookCalendarItems.IncludeRecurrences = true;
                //var filter = String.Format("[Start] >= \"{0}\" and [Start] <= \"{1}\"", DateTime.Today, DateTime.Today.AddDays(1));
                //outlookCalendarItems = outlookCalendarItems.Find(filter);

                foreach (Microsoft.Office.Interop.Outlook.AppointmentItem item in outlookCalendarItems)
                {
                    if (item.Start >= CacheRangeStart)
                    {
                        if (item.Start.Date > CacheRangeEnd)
                        {
                            break;
                        }

                        var parsed = LyncMeeting.ParseEmail(item.Body ?? string.Empty, item.Subject);
                        events.Add(new OutlookItem()
                        {
                            Start              = item.Start,
                            End                = item.End,
                            Subject            = item.Subject,
                            LyncMeeting        = parsed,
                            OutlookAppointment = item
                        });
                    }
                }

                events = events.OrderBy(e => e.Start).ToList();
                lock (Lock)
                {
                    _cache = events;
                    _cacheLastUpdateTime = DateTime.Now;
                }
            }
            catch (COMException e)
            {
                OutlookException = e;
            }
            finally
            {
                Marshal.ReleaseComObject(oApp);
            }
        }