-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfig.cs
More file actions
66 lines (58 loc) · 2.31 KB
/
Config.cs
File metadata and controls
66 lines (58 loc) · 2.31 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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace StreamStartingTimer {
public partial class Config : Form {
bool SettingsChanged = false;
public Config() {
InitializeComponent();
}
private void CloseForm(DialogResult result) {
if (SettingsChanged) {
if (MessageBox.Show( "You have not saved your settings.\r\n" +
"They will work for this session only\r\n" +
"\r\n" +
"Close config without saving?",
"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
== DialogResult.Yes) {
this.DialogResult = result;
this.Close();
}
} else {
this.DialogResult = result;
this.Close();
}
}
private void Config_Load(object sender, EventArgs e) {
propertyGrid1.SelectedObject = Shared.CurSettings;
}
private void btnOk_Click(object sender, EventArgs e) {
CloseForm(DialogResult.OK);
}
private void btnCancel_Click(object sender, EventArgs e) {
CloseForm(DialogResult.Cancel);
}
private void btnLoad_Click(object sender, EventArgs e) {
if (openFileDialog1.ShowDialog() == DialogResult.OK) {
Shared.CurSettings.LoadConfig(openFileDialog1.FileName);
Shared.frmClock.Location = Shared.CurSettings.Location;
Shared.frmClock.Size = Shared.CurSettings.Dimensions;
}
}
private void btnSave_Click(object sender, EventArgs e) {
if (saveFileDialog1.ShowDialog() == DialogResult.OK) {
Shared.CurSettings.SaveConfig(saveFileDialog1.FileName, Shared.frmClock.Location, Shared.frmClock.Size);
SettingsChanged = false;
}
}
private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) {
SettingsChanged = true;
}
}
}