Winify – Diff between revs 28 and 30
?pathlinks?
Rev 28 | Rev 30 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | using System; |
1 | using System; |
|
2 | using System.Linq; |
2 | using System.Linq; |
|
- | 3 | using System.Threading; |
||
3 | using System.Windows.Forms; |
4 | using System.Windows.Forms; |
|
4 | using Announcements; |
5 | using Announcements; |
|
5 | using Servers; |
6 | using Servers; |
|
6 | using Winify.Utilities; |
7 | using Winify.Utilities; |
|
Line 21... | Line 22... | |||
21 | |
22 | |
|
Line 22... | Line 23... | |||
22 | private readonly Announcements.Announcements _announcements; |
23 | private readonly Announcements.Announcements _announcements; |
|
Line 23... | Line 24... | |||
23 | |
24 | |
|
Line 24... | Line 25... | |||
24 | private readonly BindingSource _serverBindingSource; |
25 | private readonly BindingSource _serverBindingSource; |
|
Line 25... | Line 26... | |||
25 | |
26 | |
|
- | 27 | private readonly Servers.Servers _servers; |
||
- | 28 | |
||
Line 26... | Line 29... | |||
26 | private readonly global::Servers.Servers _servers; |
29 | private Announcement _announcement; |
|
Line 27... | Line 30... | |||
27 | |
30 | |
|
Line 28... | Line 31... | |||
28 | private Announcement _announcement; |
31 | private Server _server; |
|
29 | |
32 | private readonly MainForm _mainForm; |
|
30 | private Server _server; |
33 | private readonly CancellationToken _cancellationToken; |
|
31 | |
34 | |
|
Line -... | Line 35... | |||
- | 35 | #endregion |
||
- | 36 | |
||
- | 37 | #region Constructors, Destructors and Finalizers |
||
- | 38 | |
||
- | 39 | public SettingsForm() |
||
32 | #endregion |
40 | { |
|
- | 41 | InitializeComponent(); |
||
33 | |
42 | } |
|
34 | #region Constructors, Destructors and Finalizers |
43 | |
|
35 | |
44 | public SettingsForm(MainForm mainForm) : this() |
|
- | 45 | { |
||
Line 36... | Line 46... | |||
36 | private SettingsForm() |
46 | _mainForm = mainForm; |
|
37 | { |
47 | } |
|
Line 38... | Line 48... | |||
38 | InitializeComponent(); |
48 | |
|
Line 85... | Line 95... | |||
85 | |
95 | |
|
Line 86... | Line 96... | |||
86 | #region Event Handlers |
96 | #region Event Handlers |
|
87 | |
97 | |
|
88 | private void CheckBox1_CheckedChanged(object sender, EventArgs e) |
98 | private void CheckBox1_CheckedChanged(object sender, EventArgs e) |
|
- | 99 | { |
||
- | 100 | _mainForm.Configuration.LaunchOnBoot = ((CheckBox)sender).Checked; |
||
- | 101 | |
||
Line 89... | Line 102... | |||
89 | { |
102 | _mainForm.ChangedConfigurationContinuation.Schedule(TimeSpan.FromSeconds(1), |
|
90 | Properties.Settings.Default.LaunchOnBoot = ((CheckBox)sender).Checked; |
103 | async () => { await _mainForm.SaveConfiguration(); }, _cancellationToken); |
|
Line 91... | Line 104... | |||
91 | |
104 | |
|
92 | Miscellaneous.LaunchOnBootSet(Properties.Settings.Default.LaunchOnBoot); |
105 | Miscellaneous.LaunchOnBootSet(_mainForm.Configuration.LaunchOnBoot); |
|
93 | } |
106 | } |
|
Line 150... | Line 163... | |||
150 | } |
163 | } |
|
Line 151... | Line 164... | |||
151 | |
164 | |
|
152 | private void Button5_Click(object sender, EventArgs e) |
165 | private void Button5_Click(object sender, EventArgs e) |
|
153 | { |
166 | { |
|
- | 167 | Save?.Invoke(this, new SettingsSavedEventArgs(_servers, _announcements)); |
||
154 | Save?.Invoke(this, new SettingsSavedEventArgs(_servers, _announcements)); |
168 | |
|
155 | Close(); |
169 | Close(); |
|
Line -... | Line 170... | |||
- | 170 | } |
||
- | 171 | |
||
- | 172 | private void SettingsForm_Load(object sender, EventArgs e) |
||
- | 173 | { |
||
- | 174 | checkBox1.Checked = _mainForm.Configuration.LaunchOnBoot; |
||
156 | } |
175 | } |
|
157 | |
176 | |
|
158 | #endregion |
177 | #endregion |
|
159 | } |
178 | } |