public void ShowGeneralOptions()
        {
            var generalOptions = _generalOptionsDataAccess.LoadOptions();

            using (var optionsForm = new GeneralOptionsForm())
            {
                optionsForm.Options = generalOptions;
                if (optionsForm.Display())
                {
                    var newOptions = optionsForm.Options;

                    ConfigureServicePointManager(newOptions);
                    ConfigureLogLevel(newOptions.EnableDebugLog);

                    _updateChecker.IsEnabled        = newOptions.ShouldCheckForNewerVersions;
                    _reportGarbageCollection.MaxAge = TimeSpan.FromDays(newOptions.MaxReportAgeInDays);

                    _generalOptionsDataAccess.SaveOptions(newOptions);
                    UpdateGeneralOptionDependencies(newOptions);
                    _scheduler.SetOptions(_optionsDataAccess.LoadOptions(), newOptions.CheckIfOnline);

                    if (newOptions.EnableTrayIcon != generalOptions.EnableTrayIcon)
                    {
                        _trayNotifier.Dispose();
                        _trayNotifier = newOptions.EnableTrayIcon ? new TrayNotifier(this) : NullTrayNotifer.Instance;
                    }
                }
            }
        }
        public void ShowGeneralOptionsNoThrow()
        {
            try
            {
                var generalOptions = _generalOptionsDataAccess.LoadOptions();
                using (var optionsForm = new GeneralOptionsForm())
                {
                    optionsForm.Options = generalOptions;
                    if (optionsForm.Display())
                    {
                        var newOptions = optionsForm.Options;

                        ConfigureServicePointManager(newOptions);
                        ConfigureLogLevel(newOptions.EnableDebugLog);

                        _updateChecker.IsEnabled        = newOptions.ShouldCheckForNewerVersions;
                        _reportGarbageCollection.MaxAge = TimeSpan.FromDays(newOptions.MaxReportAgeInDays);

                        _generalOptionsDataAccess.SaveOptions(newOptions);
                        UpdateGeneralOptionDependencies(newOptions);
                        _scheduler.SetOptions(_optionsDataAccess.LoadOptions(), newOptions.CheckIfOnline);
                    }
                }
            }
            catch (Exception x)
            {
                ExceptionHandler.Instance.HandleException(x, s_logger);
            }
        }
Exemplo n.º 3
0
 void ShowErrorMessage()
 {
     if (MessageBox.Show($"CalDav Synchronizer failed to load due to the following exception: {Environment.NewLine}{_loadExceptionAsString}{Environment.NewLine}{Environment.NewLine}Do you want to open the log file ?", ComponentContainer.MessageBoxTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
     {
         GeneralOptionsForm.ShowLogFile();
     }
 }
Exemplo n.º 4
0
 public async Task ShowGeneralOptionsAsync()
 {
     await EditGeneralOptionsAsync(
         o =>
     {
         using (var optionsForm = new GeneralOptionsForm())
         {
             optionsForm.Options = o;
             if (optionsForm.Display())
             {
                 return(Tuple.Create(true, optionsForm.Options));
             }
             else
             {
                 return(Tuple.Create(false, (GeneralOptions)null));
             }
         }
     });
 }
        public async Task ShowGeneralOptions()
        {
            var generalOptions = _generalOptionsDataAccess.LoadOptions();

            using (var optionsForm = new GeneralOptionsForm())
            {
                optionsForm.Options = generalOptions;
                if (optionsForm.Display())
                {
                    var newOptions = optionsForm.Options;

                    ConfigureServicePointManager(newOptions);
                    ConfigureLogLevel(newOptions.EnableDebugLog);

                    _updateChecker.IsEnabled        = newOptions.ShouldCheckForNewerVersions;
                    _reportGarbageCollection.MaxAge = TimeSpan.FromDays(newOptions.MaxReportAgeInDays);

                    _generalOptionsDataAccess.SaveOptions(newOptions);
                    UpdateGeneralOptionDependencies(newOptions);
                    await _scheduler.SetOptions(_optionsDataAccess.LoadOptions(), newOptions);

                    if (newOptions.EnableTrayIcon != generalOptions.EnableTrayIcon)
                    {
                        _trayNotifier.Dispose();
                        _trayNotifier = newOptions.EnableTrayIcon ? new TrayNotifier(this) : NullTrayNotifer.Instance;
                    }

                    if (_syncObject != null && newOptions.TriggerSyncAfterSendReceive != generalOptions.TriggerSyncAfterSendReceive)
                    {
                        if (newOptions.TriggerSyncAfterSendReceive)
                        {
                            _syncObject.SyncEnd += _sync_SyncEnd;
                        }
                        else
                        {
                            _syncObject.SyncEnd -= _sync_SyncEnd;
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void SetupGeneralOptions()
        {
            GeneralOptionsForm form = new GeneralOptionsForm();

            form.ShowDialog();
        }