Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        private async void CreateProfile(object parameter)
        {
            if (parameter == null)
            {
                return;
            }

            if (parameter.ToString().Equals("Calendars"))
            {
                await AddNewProfile(CalendarSyncProfiles, CalendarSyncProfile.GetDefaultSyncProfile());
            }
            else if (parameter.ToString().Equals("Tasks"))
            {
                await AddNewProfile(TaskSyncProfiles, TaskSyncProfile.GetDefaultSyncProfile());
            }
            else if (parameter.ToString().Equals("Contacts"))
            {
                await AddNewProfile(ContactsSyncProfiles, ContactSyncProfile.GetDefaultSyncProfile());
            }
        }
Exemple #2
0
        private void ValidateSettings(Settings result)
        {
            if (result.GoogleAccounts == null)
            {
                result.GoogleAccounts = new ObservableCollection <GoogleAccount>();
            }

            if (result.CalendarSyncProfiles == null || result.CalendarSyncProfiles.Count == 0)
            {
                result.CalendarSyncProfiles = new ObservableCollection <CalendarSyncProfile>()
                {
                    CalendarSyncProfile.GetDefaultSyncProfile()
                };
            }
            else
            {
                foreach (var syncProfile in result.CalendarSyncProfiles)
                {
                    syncProfile.SetSourceDestTypes();
                    if (syncProfile.SyncSettings == null)
                    {
                        syncProfile.SyncSettings = CalendarSyncSettings.GetDefault();
                    }
                    else if (syncProfile.SyncSettings.SyncRangeType == SyncRangeTypeEnum.SyncEntireCalendar)
                    {
                        syncProfile.SyncSettings.SyncRangeType = SyncRangeTypeEnum.SyncRangeInDays;
                        syncProfile.SyncSettings.DaysInPast    = 120;
                        syncProfile.SyncSettings.DaysInFuture  = 120;
                    }

                    if (syncProfile.SyncFrequency == null)
                    {
                        syncProfile.SyncFrequency = new IntervalSyncFrequency();
                    }
                }
            }

            if (result.TaskSyncProfiles == null || result.TaskSyncProfiles.Count == 0)
            {
                result.TaskSyncProfiles = new ObservableCollection <TaskSyncProfile>()
                {
                    TaskSyncProfile.GetDefaultSyncProfile()
                };
            }
            else
            {
                foreach (var syncProfile in result.TaskSyncProfiles)
                {
                    syncProfile.SetSourceDestTypes();
                    if (syncProfile.SyncSettings == null)
                    {
                        syncProfile.SyncSettings = TaskSyncSettings.GetDefault();
                    }

                    if (syncProfile.SyncFrequency == null)
                    {
                        syncProfile.SyncFrequency = new IntervalSyncFrequency();
                    }
                }
            }
            if (result.ContactSyncProfiles == null || result.ContactSyncProfiles.Count == 0)
            {
                result.ContactSyncProfiles = new ObservableCollection <ContactSyncProfile>()
                {
                    ContactSyncProfile.GetDefaultSyncProfile()
                };
            }

            if (result.AppSettings == null)
            {
                result.AppSettings = AppSettings.GetDefault();
            }
            else if (result.AppSettings.ProxySettings == null)
            {
                result.AppSettings.ProxySettings = new ProxySetting
                {
                    ProxyType = ProxyType.Auto
                };
            }
        }