Ejemplo n.º 1
0
        public void FixSynchronizationMode(TestResult result)
        {
            const SynchronizationMode readOnlyDefaultMode = SynchronizationMode.ReplicateServerIntoOutlook;

            if (result.ResourceType.HasFlag(ResourceType.Calendar))
            {
                if (!result.CalendarProperties.HasFlag(CalendarProperties.IsWriteable) &&
                    OptionTasks.DoesModeRequireWriteableServerResource(_syncSettingsControl.SynchronizationMode))
                {
                    _syncSettingsControl.SynchronizationMode = readOnlyDefaultMode;
                    MessageBox.Show(
                        string.Format(
                            "The specified Url is a read-only calendar. Synchronization mode set to '{0}'.",
                            _syncSettingsControl.AvailableSynchronizationModes.Single(m => m.Value == readOnlyDefaultMode).Name),
                        OptionTasks.ConnectionTestCaption);
                }
            }

            if (result.ResourceType.HasFlag(ResourceType.AddressBook))
            {
                if (!result.AddressBookProperties.HasFlag(AddressBookProperties.IsWriteable) &&
                    OptionTasks.DoesModeRequireWriteableServerResource(_syncSettingsControl.SynchronizationMode))
                {
                    _syncSettingsControl.SynchronizationMode = readOnlyDefaultMode;
                    MessageBox.Show(
                        string.Format(
                            "The specified Url is a read-only addressbook. Synchronization mode set to '{0}'.",
                            _syncSettingsControl.AvailableSynchronizationModes.Single(m => m.Value == readOnlyDefaultMode).Name),
                        OptionTasks.ConnectionTestCaption);
                }
            }
        }
Ejemplo n.º 2
0
        public void FixSynchronizationMode(OptionsModel options, TestResult result)
        {
            const SynchronizationMode readOnlyDefaultMode = SynchronizationMode.ReplicateServerIntoOutlook;

            if (result.ResourceType.HasFlag(ResourceType.Calendar))
            {
                if (!result.AccessPrivileges.HasFlag(AccessPrivileges.Modify) &&
                    OptionTasks.DoesModeRequireWriteableServerResource(options.SynchronizationMode))
                {
                    options.SynchronizationMode = readOnlyDefaultMode;
                    MessageBox.Show(
                        $"The specified Url is a read-only calendar. Synchronization mode set to '{_enumDisplayNameProvider.Get(readOnlyDefaultMode)}'.",
                        OptionTasks.ConnectionTestCaption);
                }
            }

            if (result.ResourceType.HasFlag(ResourceType.AddressBook))
            {
                if (!result.AccessPrivileges.HasFlag(AccessPrivileges.Modify) &&
                    OptionTasks.DoesModeRequireWriteableServerResource(options.SynchronizationMode))
                {
                    options.SynchronizationMode = readOnlyDefaultMode;
                    MessageBox.Show(
                        $"The specified Url is a read-only addressbook. Synchronization mode set to '{_enumDisplayNameProvider.Get(readOnlyDefaultMode)}'.",
                        OptionTasks.ConnectionTestCaption);
                }
            }
        }
        public void FixSynchronizationMode(OptionsModel options, TestResult result)
        {
            const SynchronizationMode readOnlyDefaultMode = SynchronizationMode.ReplicateServerIntoOutlook;

            if (result.ResourceType.HasFlag(ResourceType.Calendar))
            {
                if (!result.AccessPrivileges.HasFlag(AccessPrivileges.Modify) &&
                    OptionTasks.DoesModeRequireWriteableServerResource(options.SynchronizationMode))
                {
                    options.SynchronizationMode = readOnlyDefaultMode;
                    MessageBox.Show(
                        Strings.Get($"The specified URL is a read-only calendar. Synchronization mode set to '{_enumDisplayNameProvider.Get(readOnlyDefaultMode)}'."),
                        OptionTasks.ConnectionTestCaption);
                }
            }

            if (result.ResourceType.HasFlag(ResourceType.AddressBook))
            {
                if (!result.AccessPrivileges.HasFlag(AccessPrivileges.Modify) &&
                    OptionTasks.DoesModeRequireWriteableServerResource(options.SynchronizationMode))
                {
                    options.SynchronizationMode = readOnlyDefaultMode;
                    MessageBox.Show(
                        Strings.Get($"The specified URL is a read-only addressbook. Synchronization mode set to '{_enumDisplayNameProvider.Get(readOnlyDefaultMode)}'."),
                        OptionTasks.ConnectionTestCaption);
                }
            }

            if (options.SynchronizationMode == readOnlyDefaultMode && options.SelectedFolderOrNull?.ItemCount > 0)
            {
                MessageBox.Show(
                    Strings.Get($"Synchronization mode is set to '{_enumDisplayNameProvider.Get(readOnlyDefaultMode)}' and the selected Outlook folder is not empty. Are you sure, you want to select this folder because all items will be overwritten with the DAV server resources!"),
                    OptionTasks.ConnectionTestCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (options.SynchronizationMode == SynchronizationMode.ReplicateOutlookIntoServer && options.SelectedFolderOrNull?.ItemCount == 0)
            {
                MessageBox.Show(
                    Strings.Get($"Synchronization mode is set to '{_enumDisplayNameProvider.Get(SynchronizationMode.ReplicateOutlookIntoServer)}' and the selected Outlook folder is empty. Are you sure, you want to select this folder, because all items on the DAV server will be deleted!"),
                    OptionTasks.ConnectionTestCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }