/// <summary>
        ///     Gets default calendar profile for the user
        /// </summary>
        /// <returns>
        /// </returns>
        public static CalendarSyncProfile GetDefaultSyncProfile()
        {
            var syncProfile = new CalendarSyncProfile
            {
                SyncSettings    = CalendarSyncSettings.GetDefault(),
                OutlookSettings =
                {
                    OutlookOptions = OutlookOptionsEnum.OutlookDesktop |
                                     OutlookOptionsEnum.DefaultProfile |
                                     OutlookOptionsEnum.DefaultMailBoxCalendar,
                    SetOrganizer   = true
                },
                CalendarEntryOptions =
                    CalendarEntryOptionsEnum.Description | CalendarEntryOptionsEnum.Attendees |
                    CalendarEntryOptionsEnum.AttendeesToDescription |
                    CalendarEntryOptionsEnum.Reminders | CalendarEntryOptionsEnum.AsAppointments,
                SyncDirection = SyncDirectionEnum.OutlookGoogleOneWay,

                SyncFrequency = new IntervalSyncFrequency {
                    Hours = 1, Minutes = 0, StartTime = DateTime.Now
                }
            };

            syncProfile.SetSourceDestTypes();
            return(syncProfile);
        }
 /// <summary>
 ///     Gets default calendar profile for the user
 /// </summary>
 /// <returns>
 /// </returns>
 public static CalendarSyncProfile GetDefaultSyncProfile()
 {
     var syncProfile = new CalendarSyncProfile
     {
         SyncSettings = CalendarSyncSettings.GetDefault(),
         OutlookSettings =
         {
             OutlookOptions =  OutlookOptionsEnum.OutlookDesktop |
                                 OutlookOptionsEnum.DefaultProfile |
                              OutlookOptionsEnum.DefaultMailBoxCalendar,
             SetOrganizer = true
         },
         CalendarEntryOptions =
             CalendarEntryOptionsEnum.Description | CalendarEntryOptionsEnum.Attendees |
             CalendarEntryOptionsEnum.AttendeesToDescription |
             CalendarEntryOptionsEnum.Reminders | CalendarEntryOptionsEnum.AsAppointments,
             SyncDirection = SyncDirectionEnum.OutlookGoogleOneWay,
         SyncFrequency = new IntervalSyncFrequency {Hours = 1, Minutes = 0, StartTime = DateTime.Now}
     };
     syncProfile.SetSourceDestTypes();
     return syncProfile;
 }
Exemplo n.º 3
0
 /// <summary>
 /// </summary>
 /// <returns>
 /// </returns>
 public static Settings GetDefaultSettings()
 {
     var settings = new Settings
     {
         IsFirstSave = true,
         SettingsVersion = ApplicationInfo.Version,
         AppSettings = AppSettings.GetDefault(),
         CalendarSyncProfiles = new ObservableCollection<CalendarSyncProfile>
         {
             CalendarSyncProfile.GetDefaultSyncProfile()
         },
         TaskSyncProfiles = new ObservableCollection<TaskSyncProfile>
         {
             TaskSyncProfile.GetDefaultSyncProfile()
         },
         ContactSyncProfiles = new ObservableCollection<ContactSyncProfile>
         {
             ContactSyncProfile.GetDefaultSyncProfile()
         },
         GoogleAccounts = new ObservableCollection<GoogleAccount>()
     };
     return settings;
 }
Exemplo n.º 4
0
        public string SyncNow(CalendarSyncProfile syncProfile, SyncMetric syncMetric, SyncCallback syncCallback)
        {
            try
            {
                if (syncProfile.GoogleSettings.GoogleAccount == null || 
                    syncProfile.GoogleSettings.GoogleCalendar == null ||
                    !syncProfile.ValidateOutlookSettings())
                {
                    MessageService.ShowMessageAsync(
                        "Please configure Google and Outlook calendar in settings to continue.");
                    return "Invalid Settings";
                }
                ResetSyncData();

                var isSyncComplete = CalendarUpdateService.SyncCalendar(syncProfile, syncMetric, syncCallback);
                return isSyncComplete ? null : "Error Occurred";
            }
            catch (AggregateException exception)
            {
                var flattenException = exception.Flatten();
                MessageService.ShowMessageAsync(flattenException.Message);
                Logger.Error(exception);
                return flattenException.Message;
            }
            catch (Exception exception)
            {
                MessageService.ShowMessageAsync(exception.Message);
                Logger.Error(exception);
                return exception.Message;
            }
        }