-
Notifications
You must be signed in to change notification settings - Fork 0
/
IPEditForm.cs
85 lines (78 loc) · 3.01 KB
/
IPEditForm.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
using System;
using System.Windows.Forms;
namespace Schematix
{
public partial class IPEditForm : Form
{
public xIP IP;
public IPEditForm(xIP ip, xObject owner)//Ok
{
InitializeComponent();
//Main
tpPings.Text = Options.LangCur.lIPTabMain;
lblAddress.Text = Options.LangCur.lIPAddress;
lblName.Text = Options.LangCur.lEOName;
lblPeriod.Text = Options.LangCur.lIPPeriod;
lblTimeNext.Text = Options.LangCur.lIPTimeNext;
lblTimeOutGreen.Text = Options.LangCur.lIPTimeOutGreen;
lblTimeOutYellow.Text = Options.LangCur.lIPTimeOutYellow;
lblTimeOutRed.Text = Options.LangCur.lIPTimeOutRed;
// Fill
if (ip == null)
{
Text = Options.LangCur.lIPTitleAdd;
ip = new xIP(owner);
}
else
Text = Options.LangCur.lIPTitleEdit;
IP = ip;
tbName.Text = IP.Name;
tbDescription.Text = IP.Description;
tbAddress.Text = IP.Address;
//
nudTimeOutGreen.Value = IP.TimeOutGreen;
nudTimeOutYellow.Value = IP.TimeOutYellow;
nudTimeOutRed.Value = IP.TimeOutRed;
//
dtpDateNext.Value = IP.TimeNext;
dtpDateNext.Checked = IP.Onn;
nudPeriod.Value = IP.Period;
// Pings
tpPings.Text = Options.LangCur.lIPTabPings;
clmSendTime.Text = Options.LangCur.lIPColumSendTime;
clmState.Text = Options.LangCur.lIPColumState;
clmTripTime.Text = Options.LangCur.lIPColumTripTime;
toolTip.SetToolTip(btnClearPings, Options.LangCur.hIPClearPings);
// Fill
for (int i = 0; i < IP.PingsCount; i++)
if(IP.Pings[i].State != PingStates.NotSend)
Share.lvPings_Add(lvPings, IP, IP.Pings[i]);
IP.Pings_lv = lvPings;
// Push window sizes
tabControl.Width = tlpTimers.Width + 16;
}
private void btnClearPings_Click(object sender, EventArgs e)
{
lvPings.Items.Clear();
IP.ClearPings();
}
private void IPEditForm_FormClosing(object sender, FormClosingEventArgs e) => IP.Pings_lv = null;
private void btnOk_Click(object sender, EventArgs e)//Ok
{
IP.Name = tbName.Text;
IP.Description = tbDescription.Text;
IP.Address = tbAddress.Text;
//
IP.TimeOutGreen = (int)nudTimeOutGreen.Value;
IP.TimeOutYellow = (int)nudTimeOutYellow.Value;
IP.TimeOutRed = (int)nudTimeOutRed.Value;
//
IP.TimeNext = dtpDateNext.Value;
IP.Onn = dtpDateNext.Checked;
IP.Period = (int)nudPeriod.Value;
// Out
DialogResult = DialogResult.OK;
Close();
}
}
}