This repository was archived by the owner on Mar 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDashboard.xaml.cs
More file actions
105 lines (90 loc) · 3 KB
/
Dashboard.xaml.cs
File metadata and controls
105 lines (90 loc) · 3 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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.Navigation;
using System.Windows.Shapes;
using System.Xml.Linq;
using System.Xml;
namespace TorchFlow
{
public partial class Dashboard : Window
{
public Dashboard()
{
InitializeComponent();
Var.Check_db_directory();
Var.Check_xml();
#region xml textbox load
try
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Var.Direcotry_db + "settings.xml");
XmlNodeList CList = xmlDoc.GetElementsByTagName("Width");
for (int i = 0; i < CList.Count; i++)
{
Width_txt.Text = CList[i].InnerText.ToString();
}
XmlNodeList CList2 = xmlDoc.GetElementsByTagName("Height");
for (int i = 0; i < CList2.Count; i++)
{
Height_txt.Text = CList2[i].InnerText.ToString();
}
XmlNodeList CList3 = xmlDoc.GetElementsByTagName("Color");
for (int i = 0; i < CList3.Count; i++)
{
Color_txt.Text = CList3[i].InnerText.ToString();
}
}
catch
{
MessageBox.Show("error xml load");
}
#endregion
}
private void Button_Click(object sender, RoutedEventArgs e)
{
#region Xml Save
if (Width_txt.Text.Length == 0)
{
MessageBox.Show("Il valore Width non può essere vuoto");
return;
}
if (Height_txt.Text.Length == 0)
{
MessageBox.Show("Il valore Height non può essere vuoto");
return;
}
if (Color_txt.Text.Length == 0)
{
MessageBox.Show("Il valore Color non può essere vuoto");
return;
}
XDocument xml_doc = new XDocument(new XElement("settings",
new XElement("Width", Width_txt.Text),
new XElement("Height", Height_txt.Text),
new XElement("Color", Color_txt.Text)
));
xml_doc.Save(Var.Direcotry_db + "settings.xml");
MessageBox.Show("Saved");
#endregion
/*try
{
BrushConverter bc = new BrushConverter();
panel.Background = (Brush)bc.ConvertFrom(TextBox1.Text);
}
catch
{
MessageBox.Show("Check the color!");
}*/
}
}
}