forked from kurumpa/dotSwitcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettings.cs
More file actions
110 lines (103 loc) · 2.86 KB
/
Settings.cs
File metadata and controls
110 lines (103 loc) · 2.86 KB
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
using System;
using System.Configuration;
using System.Windows.Forms;
namespace dotSwitcher
{
[Serializable]
public sealed class Settings : ApplicationSettingsBase, ISettings
{
public static Settings Init()
{
var settings = new Settings();
settings.Reload();
if (settings.SwitchHotkey.KeyData == Keys.None)
{
settings.SwitchHotkey = new KeyboardEventArgs(Keys.Pause, false);
}
if (settings.ConvertSelectionHotkey.KeyData == Keys.None)
{
settings.ConvertSelectionHotkey = new KeyboardEventArgs(Keys.Pause | Keys.Shift, false);
}
if (settings.ShowTrayIcon == null)
{
settings.ShowTrayIcon = true;
}
if (settings.SwitchDelay < 1)
{
settings.SwitchDelay = 20;
}
settings.Save();
return settings;
}
[UserScopedSetting]
[SettingsSerializeAs(SettingsSerializeAs.Binary)]
[DefaultSettingValue("")]
public KeyboardEventArgs SwitchHotkey
{
get
{
return (KeyboardEventArgs)this["SwitchHotkey"];
}
set
{
this["SwitchHotkey"] = (KeyboardEventArgs)value;
}
}
[UserScopedSetting]
[SettingsSerializeAs(SettingsSerializeAs.Binary)]
[DefaultSettingValue("")]
public KeyboardEventArgs ConvertSelectionHotkey
{
get
{
return (KeyboardEventArgs)this["ConvertSelectionHotkey"];
}
set
{
this["ConvertSelectionHotkey"] = (KeyboardEventArgs)value;
}
}
[UserScopedSetting]
[SettingsSerializeAs(SettingsSerializeAs.Binary)]
[DefaultSettingValue("")]
public bool? AutoStart
{
get
{
return (bool?)this["AutoStart"];
}
set
{
this["AutoStart"] = (bool?)value;
}
}
[UserScopedSetting]
[SettingsSerializeAs(SettingsSerializeAs.Binary)]
[DefaultSettingValue("")]
public bool? ShowTrayIcon
{
get
{
return (bool?)this["ShowTrayIcon"];
}
set
{
this["ShowTrayIcon"] = (bool?)value;
}
}
[UserScopedSetting]
[SettingsSerializeAs(SettingsSerializeAs.Binary)]
[DefaultSettingValue("")]
public int SwitchDelay
{
get
{
return (int)this["SwitchDelay"];
}
set
{
this["SwitchDelay"] = (int)value;
}
}
}
}