Example #1
0
        public ICalendarService GetCalendarService(CalendarServiceType serviceType)
        {
            var serviceInstance =
                CalendarServicesFactoryLazy.FirstOrDefault(list => list.Metadata.ServiceType == serviceType);

            if (serviceInstance != null)
            {
                return(serviceInstance.Value);
            }
            throw new ArgumentException("Calendar Service Type is not Available/Registered", "serviceType");
        }
        public ICalendarService GetCalendarService(CalendarServiceType serviceType)
        {
            var serviceInstance =
                CalendarServicesFactoryLazy.FirstOrDefault(list => list.Metadata.ServiceType == serviceType);

            if (serviceInstance != null)
            {
                return serviceInstance.Value;
            }
            throw new ArgumentException("Calendar Service Type is not Available/Registered", "serviceType");
        }
Example #3
0
        private string GetCalendarName(CalendarSyncProfile syncProfile, CalendarServiceType calendarServiceType)
        {
            switch (calendarServiceType)
            {
            case CalendarServiceType.Google:
                return(string.Format("{0} - {1}", syncProfile.GoogleAccount.Name,
                                     syncProfile.GoogleAccount.GoogleCalendar.Name));

            case CalendarServiceType.OutlookDesktop:
                return(syncProfile.OutlookSettings.OutlookOptions.HasFlag(OutlookOptionsEnum.DefaultCalendar)
                        ? "Default Calendar"
                        : string.Format("{0} - {1}", syncProfile.OutlookSettings.OutlookMailBox.Name,
                                        syncProfile.OutlookSettings.OutlookCalendar.Name));
            }
            return(string.Empty);
        }
Example #4
0
        private IDictionary <string, object> GetCalendarSpecificData(CalendarServiceType serviceType,
                                                                     CalendarSyncProfile syncProfile)
        {
            IDictionary <string, object> calendarSpecificData = null;

            switch (serviceType)
            {
            case CalendarServiceType.Google:
                calendarSpecificData = new Dictionary <string, object>
                {
                    { "CalendarId", syncProfile.GoogleAccount.GoogleCalendar.Id },
                    { "AccountName", syncProfile.GoogleAccount.Name }
                };
                break;

            case CalendarServiceType.OutlookDesktop:
                calendarSpecificData = new Dictionary <string, object>
                {
                    {
                        "ProfileName",
                        !syncProfile.OutlookSettings.OutlookOptions.HasFlag(OutlookOptionsEnum.DefaultProfile)
                                ? syncProfile.OutlookSettings.OutlookProfileName
                                : null
                    },
                    {
                        "OutlookCalendar",
                        !syncProfile.OutlookSettings.OutlookOptions.HasFlag(OutlookOptionsEnum.DefaultCalendar)
                                ? syncProfile.OutlookSettings.OutlookCalendar
                                : null
                    },
                    {
                        "AddAsAppointments",
                        syncProfile.CalendarEntryOptions.HasFlag(CalendarEntryOptionsEnum.AsAppointments)
                    }
                };
                break;

            case CalendarServiceType.EWS:
                return(null);
            }
            if (calendarSpecificData != null && syncProfile.SetCalendarCategory)
            {
                calendarSpecificData.Add("EventCategory", syncProfile.EventCategory);
            }
            return(calendarSpecificData);
        }
 private IDictionary<string, object> GetCalendarSpecificData(CalendarServiceType serviceType,
     CalendarSyncProfile syncProfile)
 {
     IDictionary<string, object> calendarSpecificData = null;
     switch (serviceType)
     {
         case CalendarServiceType.Google:
             calendarSpecificData = new Dictionary<string, object>
             {
                 {"CalendarId", syncProfile.GoogleAccount.GoogleCalendar.Id},
                 {"AccountName", syncProfile.GoogleAccount.Name}
             };
             break;
         case CalendarServiceType.OutlookDesktop:
             calendarSpecificData = new Dictionary<string, object>
             {
                 {
                     "ProfileName",
                     !syncProfile.OutlookSettings.OutlookOptions.HasFlag(OutlookOptionsEnum.DefaultProfile)
                         ? syncProfile.OutlookSettings.OutlookProfileName
                         : null
                 },
                 {
                     "OutlookCalendar",
                     !syncProfile.OutlookSettings.OutlookOptions.HasFlag(OutlookOptionsEnum.DefaultCalendar)
                         ? syncProfile.OutlookSettings.OutlookCalendar
                         : null
                 },
                 {
                     "AddAsAppointments",
                     syncProfile.CalendarEntryOptions.HasFlag(CalendarEntryOptionsEnum.AsAppointments)
                 }
             };
             break;
         case CalendarServiceType.EWS:
             return null;
     }
     if (calendarSpecificData != null && syncProfile.SetCalendarCategory)
     {
         calendarSpecificData.Add("EventCategory", syncProfile.EventCategory);
     }
     return calendarSpecificData;
 }
 private string GetCalendarName(CalendarSyncProfile syncProfile, CalendarServiceType calendarServiceType)
 {
     switch (calendarServiceType)
     {
         case CalendarServiceType.Google:
             return string.Format("{0} - {1}", syncProfile.GoogleAccount.Name,
                 syncProfile.GoogleAccount.GoogleCalendar.Name);
         case CalendarServiceType.OutlookDesktop:
             return syncProfile.OutlookSettings.OutlookOptions.HasFlag(OutlookOptionsEnum.DefaultCalendar)
                 ? "Default Calendar"
                 : string.Format("{0} - {1}", syncProfile.OutlookSettings.OutlookMailBox.Name,
                     syncProfile.OutlookSettings.OutlookCalendar.Name);
     }
     return string.Empty;
 }