This repository was archived by the owner on May 28, 2020. It is now read-only.
forked from darktohka/NetworkSimulation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimulationForm.cs
More file actions
66 lines (62 loc) · 2.48 KB
/
Copy pathSimulationForm.cs
File metadata and controls
66 lines (62 loc) · 2.48 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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace NetworkSimulation
{
public partial class SimulationForm : Form
{
public int objectId;
public NetworkObject networkObject;
public SimulationForm(int objectId)
{
this.objectId = objectId;
this.networkObject = Settings.GetSingleton().GetObject(objectId);
InitializeComponent();
}
private void SimulationForm_Load(object sender, EventArgs e)
{
label14.Text = networkObject.GetConnectionStateString();
label15.Text = networkObject.GetTrueUploadMbps() + " mbps";
label16.Text = networkObject.GetTrueDownloadMbps() + " mbps";
label17.Text = networkObject.GetFinalPingRate() + " ms";
label18.Text = networkObject.GetFinalPacketLossChance() + "%";
label19.Text = networkObject.GetUploadMbpsUsage() + " mbps";
label20.Text = networkObject.GetDownloadMbpsUsage() + " mbps";
MbpsUsage uploadUsage = networkObject.GetTotalUploadMbpsUsage();
MbpsUsage downloadUsage = networkObject.GetTotalDownloadMbpsUsage();
label21.Text = uploadUsage.currentUsage + " mbps";
label22.Text = downloadUsage.currentUsage + " mbps";
label23.Text = uploadUsage.maxUsage + " mbps";
label24.Text = downloadUsage.maxUsage + " mbps";
if (uploadUsage.IsOverloaded())
{
label25.Text = "UPLOAD OVERLOADED";
label25.ForeColor = Color.DarkRed;
} else if (downloadUsage.IsOverloaded())
{
label25.Text = "DOWNLOAD OVERLOADED";
label25.ForeColor = Color.DarkRed;
}
else if (networkObject.GetUploadMbpsUsage() > networkObject.GetTrueUploadMbps())
{
label25.Text = "UPLOAD NIC BOTTLENECK";
label25.ForeColor = Color.DarkRed;
}
else if (networkObject.GetDownloadMbpsUsage() > networkObject.GetTrueDownloadMbps())
{
label25.Text = "DOWNLOAD NIC BOTTLENECK";
label25.ForeColor = Color.DarkRed;
} else
{
label25.Text = "ALL OPTIMAL";
label25.ForeColor = Color.Green;
}
}
}
}