Ejemplo n.º 1
0
        public void ShowOptionsDialog()
        {
            var o = new Options(FontInfo.GetControlFont(_window.lbTasks));

            o.Owner = _window;

            var res = o.ShowDialog();

            if (res.Value)
            {
                User.Default.ArchiveFilePath = o.tbArchiveFile.Text;
                User.Default.AutoArchive     = o.cbAutoArchive.IsChecked.Value;
                User.Default.MoveFocusToTaskListAfterAddingNewTask = o.cbMoveFocusToTaskListAfterAddingNewTask.IsChecked.Value;
                User.Default.AutoRefresh          = o.cbAutoRefresh.IsChecked.Value;
                User.Default.FilterCaseSensitive  = o.cbCaseSensitiveFilter.IsChecked.Value;
                User.Default.AddCreationDate      = o.cbAddCreationDate.IsChecked.Value;
                User.Default.DebugLoggingOn       = o.cbDebugOn.IsChecked.Value;
                User.Default.MinimiseToSystemTray = o.cbMinToSysTray.IsChecked.Value;
                User.Default.RequireCtrlEnter     = o.cbRequireCtrlEnter.IsChecked.Value;
                User.Default.AllowGrouping        = o.cbAllowGrouping.IsChecked.Value;

                // Unfortunately, font classes are not serializable, so all the pieces are tracked instead.
                User.Default.TaskListFontFamily     = o.TaskListFont.Family.ToString();
                User.Default.TaskListFontSize       = o.TaskListFont.Size;
                User.Default.TaskListFontStyle      = o.TaskListFont.Style.ToString();
                User.Default.TaskListFontWeight     = o.TaskListFont.Weight.ToString();
                User.Default.TaskListFontStretch    = o.TaskListFont.Stretch.ToString();
                User.Default.TaskListFontBrushColor = o.TaskListFont.BrushColor.ToString();

                User.Default.Save();

                Log.LogLevel = User.Default.DebugLoggingOn ? LogLevel.Debug : LogLevel.Error;

                _window.SetFont();

                UpdateDisplayedTasks();
            }
        }