This repository has been archived by the owner on May 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComponentSettings.cs
56 lines (47 loc) · 1.89 KB
/
ComponentSettings.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace LiveSplit.UI.Components
{
public partial class ComponentSettings : UserControl
{
public bool autoReset { get; set; }
public bool autoStart { get; set; }
public bool autoSplit { get; set; }
public ComponentSettings()
{
InitializeComponent();
autoReset = true;
autoStart = true;
autoSplit = true;
chkAutoReset.DataBindings.Add("Checked", this, "autoReset", false, DataSourceUpdateMode.OnPropertyChanged);
chkAutoStart.DataBindings.Add("Checked", this, "autoStart", false, DataSourceUpdateMode.OnPropertyChanged);
chkAutoSplit.DataBindings.Add("Checked", this, "autoSplit", false, DataSourceUpdateMode.OnPropertyChanged);
}
public System.Xml.XmlNode GetSettings(System.Xml.XmlDocument document)
{
var settingsNode = document.CreateElement("Settings");
var node = document.CreateElement("autoReset");
node.InnerText = autoReset.ToString();
settingsNode.AppendChild(node);
node = document.CreateElement("autoStart");
node.InnerText = autoStart.ToString();
settingsNode.AppendChild(node);
node = document.CreateElement("autoSplit");
node.InnerText = autoSplit.ToString();
settingsNode.AppendChild(node);
return settingsNode;
}
public void SetSettings(System.Xml.XmlNode settings)
{
autoReset = Boolean.Parse(settings["autoReset"].InnerText);
autoStart = Boolean.Parse(settings["autoStart"].InnerText);
autoSplit = Boolean.Parse(settings["autoSplit"].InnerText);
}
}
}