-
Notifications
You must be signed in to change notification settings - Fork 123
/
Options.xaml.cs
116 lines (102 loc) · 3.87 KB
/
Options.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Microsoft.Win32;
using ColorFont;
namespace Client
{
/// <summary>
/// Interaction logic for Options.xaml
/// </summary>
public partial class Options : Window
{
public Options(FontInfo taskFont)
{
InitializeComponent();
tbArchiveFile.Text = User.Default.ArchiveFilePath;
cbAutoArchive.IsChecked = User.Default.AutoArchive;
cbAutoSelectArchivePath.IsChecked = User.Default.AutoSelectArchivePath;
cbAutoRefresh.IsChecked = User.Default.AutoRefresh;
cbCaseSensitiveFilter.IsChecked = User.Default.FilterCaseSensitive;
cbIntellisenseCaseSensitive.IsChecked = User.Default.IntellisenseCaseSensitive;
cbAddCreationDate.IsChecked = User.Default.AddCreationDate;
cbDebugOn.IsChecked = User.Default.DebugLoggingOn;
cbMinToSysTray.IsChecked = User.Default.MinimiseToSystemTray;
cbMinOnClose.IsChecked = User.Default.MinimiseOnClose;
cbRequireCtrlEnter.IsChecked = User.Default.RequireCtrlEnter;
cbAllowGrouping.IsChecked = User.Default.AllowGrouping;
cbMoveFocusToTaskListAfterAddingNewTask.IsChecked = User.Default.MoveFocusToTaskListAfterAddingNewTask;
cbPreserveWhiteSpace.IsChecked = User.Default.PreserveWhiteSpace;
cbWordWrap.IsChecked = User.Default.WordWrap;
this.TaskListFont = taskFont;
this.cbDisplayStatusBar.IsChecked = User.Default.DisplayStatusBar;
this.cbCheckForUpdates.IsChecked = User.Default.CheckForUpdates;
}
private FontInfo taskListFont;
/// <summary>
/// The font specifically used by the task list.
/// </summary>
public FontInfo TaskListFont
{
get
{
return this.taskListFont;
}
private set
{
this.taskListFont = value;
if (this.taskListFont != null)
{
this.currentFontDisplay.Text = string.Format("{0}, {1}-{2}-{3}, {4}",
this.taskListFont.Family,
this.taskListFont.Style,
this.taskListFont.Weight,
this.taskListFont.Stretch,
this.taskListFont.Size
);
}
}
}
private void button1_Click(object sender, RoutedEventArgs e)
{
var dialog = new OpenFileDialog();
dialog.DefaultExt = ".txt";
dialog.Filter = "Text documents (.txt)|*.txt";
var res = dialog.ShowDialog();
if (res.Value)
tbArchiveFile.Text = dialog.FileName;
}
private void OK_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
}
private void Cancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
}
/// <summary>
/// Opens the Font dialog.
/// </summary>
/// <param name="sender">Not used.</param>
/// <param name="e">Not used.</param>
private void selectFonts_Click(object sender, RoutedEventArgs e)
{
var taskFontDialog = new ColorFontDialog();
taskFontDialog.Font = this.TaskListFont;
var fontResult = taskFontDialog.ShowDialog();
if (fontResult == true)
{
this.TaskListFont = taskFontDialog.Font;
}
}
}
}