-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCoordinate.xaml.cs
More file actions
124 lines (114 loc) · 3.81 KB
/
Coordinate.xaml.cs
File metadata and controls
124 lines (114 loc) · 3.81 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
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 Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.IO;
namespace PM
{
/// <summary>
/// Interaction logic for Coordinate.xaml
/// </summary>
public partial class Coordinate : UserControl
{
private Json _json;
private Xml _xml;
private BeaconData _beaconData;
private Config _config;
private UsedData _usedData;
private QRCode _qrCode;
public Coordinate(ProjectsList.ProjectFiles p)
{
InitializeComponent();
string projectPath = p.FullPath;
int length = projectPath.IndexOf(".rvt");
projectPath = projectPath.Substring(0, length);
Project.Path = projectPath;
_json = new Json();
_xml = new Xml();
_beaconData = new BeaconData();
_config = new Config();
_usedData = new UsedData();
_qrCode = new QRCode();
}
private void btnSend_Click(object sender, RoutedEventArgs e)
{
if (beaconSelect.SelectedItem == null)
{
MessageBox.Show("Please select data first.");
return;
}
string uuid = beaconSelect.SelectedItem.ToString();
_config.Write();
SCP scp = new SCP(txtHost.Text, txtUser.Text, txtPass.Text);
_usedData.Add(uuid);
_beaconData.Used();
beaconSelect.ItemsSource = _beaconData.AvailableList();
lsLast.ItemsSource = _config.ConfText;
_qrCode.SavePicture(uuid);
PrintDocument pd = new PrintDocument();
pd.PrintPage += _qrCode.PrintPage;
pd.Print();
}
private void btnPing_Click(object sender, RoutedEventArgs e)
{
PingTest ping = new PingTest(txtHost.Text);
}
private void beaconSelect_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (beaconSelect.SelectedItem == null)
{
return;
}
string uuid = beaconSelect.SelectedItem.ToString();
_beaconData.WhichData(uuid);
_config.Change(_beaconData.Number);
lsLast.ItemsSource = null;
lsLast.ItemsSource = _config.ConfText;
}
private void btnJson_Click(object sender, RoutedEventArgs e)
{
if (_json.Exist == false)
{
MessageBox.Show("No json file.");
return;
}
_json.Transfer();
_beaconData.Used();
beaconSelect.ItemsSource = _beaconData.AvailableList();
lsLast.ItemsSource = _config.ConfText;
btnJson.Visibility = Visibility.Hidden;
btnXml.Visibility = Visibility.Hidden;
}
private void btnXml_Click(object sender, RoutedEventArgs e)
{
if (_xml.Exist == false)
{
MessageBox.Show("No xml file.");
return;
}
_xml.Transfer();
_beaconData.Used();
beaconSelect.ItemsSource = _beaconData.AvailableList();
lsLast.ItemsSource = _config.ConfText;
btnJson.Visibility = Visibility.Hidden;
btnXml.Visibility = Visibility.Hidden;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
NetAPI netAPI = new NetAPI();
}
}
}