-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainApp.cs
62 lines (53 loc) · 1.88 KB
/
MainApp.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
57
58
59
60
61
62
using MikrotikUserMonitoring.controller;
using MikrotikUserMonitoring.model;
using tik4net.Objects;
namespace MikrotikUserMonitoring
{
public partial class MainApp : Form, ImplEventChangeListener
{
private Transaction transaction;
public MainApp()
{
InitializeComponent();
checkAppConfig();
}
public void onPushToUpdateData()
{
}
private void checkAppConfig()
{
string filename = "mikro.config";
if (!File.Exists(filename))
{
File.Create(filename);
}
else
{
string[] configs = File.ReadAllLines(filename);
this.transaction = new Transaction(this);
this.transaction.HOSTNAME = configs[0];
this.transaction.USERNAME = configs[1];
this.transaction.PASSWORD = configs[2];
this.transaction.openConnection();
//MessageBox.Show("HostnamePasswordusernameHostnamePasswordusername");
//MessageBox.Show(transaction.HOSTNAME+transaction.USERNAME+transaction.PASSWORD);
}
if (transaction != null)
{
this.Text = "Routerboard : " + transaction.getIdentity();
string hosts = "";
int lineNumber = 0;
foreach (UserDevice uDevice in transaction.getHostsWithDhcpServer())
{
dgvHosts.Rows.Add(++lineNumber, uDevice.MacAddress, uDevice.ToAddress, "", "", "", uDevice.DeviceName, uDevice.Comment);
}
}
//MessageBox.Show(hosts);
}
private void settingConnectionBtn_Click(object sender, EventArgs e)
{
AppConfigConnection appConfig = new AppConfigConnection();
appConfig.ShowDialog();
}
}
}