Skip to content

Commit 5a13045

Browse files
committed
Changed graph scale units from bytes to kilobytes.
Removed NetworkInterfaceSampler data source and bindings.
1 parent ba359b6 commit 5a13045

File tree

7 files changed

+21
-64
lines changed

7 files changed

+21
-64
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Reading from the left, the graph above shows we started downloading data at full
2424

2525
### Calibration
2626

27-
The scale of the graph is shown in bytes per second on the left of the graph. This can be changed by modifying the *actual speed* value in network settings. By default the actual speed is the same as the reported speed, which is the theoretical maximum speed reported by the adapter's device driver, but is usually much higher than the actual speed of a typical internet connection so we must calibrate it to a more realistic value.
27+
The scale of the graph is shown in kilobytes per second on the left of the graph. This can be changed by modifying the *actual speed* value in network settings. By default the actual speed is the same as the reported speed, which is the theoretical maximum speed reported by the adapter's device driver, but is usually much higher than the actual speed of a typical internet connection so we must calibrate it to a more realistic value.
2828

2929
<img src="https://github.com/ScriptFUSION/UpDown-Meter/wiki/images/speedtest.gif" align="right">
3030
To calibrate the speed of an internet connection we must apply full load to the connection to test its capacity. The easiest way to do this is visit a benchmarking site such as [Speedtest.net](http://www.speedtest.net). After performing the test, return to the *actual speed* setting and modify the value until the upload or download bar (whichever is taller) just touches the horizontal bar across the top of the graph, as shown on the right.
@@ -46,7 +46,7 @@ Contributing
4646

4747
Everyone is welcome to contribute anything, from [ideas][Issues] to [issues][Issues] to graphics to documentation to [code][PRs]!
4848

49-
Compiling the code is as easy as cloning the source in Visual Studio and clicking *start*, in newer versions of Visual Studio. In older versions, it may be necessary to manually restore NuGet packages after cloning.
49+
Compiling the code is as easy as cloning the source in Visual Studio and clicking *start*. In older versions of Visual Studio, it may be necessary to manually restore NuGet packages after cloning.
5050

5151

5252
[Releases]: https://github.com/ScriptFUSION/UpDown-Meter/releases

Source/Forms/NetGraphForm.Designer.cs

Lines changed: 12 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/Forms/NetGraphForm.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public NetGraphForm() {
2121

2222
toolbox.BackColor = BackColor.Desaturate(.15f).Darken(.14f);
2323

24-
samplerBindingSource.Add(sampler = netGraph.Sampler = new NetworkInterfaceSampler());
24+
sampler = netGraph.Sampler = new NetworkInterfaceSampler();
2525
sampler.SampleAdded += Sampler_SampleAdded;
2626

2727
Options = new Options(Settings.Default);
@@ -77,6 +77,8 @@ private void SyncOptionsWithSampler(Options options) {
7777
var nic = sampler.NetworkInterface = options.NetworkInterface;
7878

7979
sampler.MaximumSpeed = options.NicSpeeds.ContainsKey(nic?.Id ?? string.Empty) ? options.NicSpeeds[nic.Id] : 0;
80+
81+
nicSpeed.Text = Math.Round(sampler.MaximumSpeed / 1000f).ToString("0 kB/s");
8082
}
8183

8284
private void SyncOptionsWithUI(Options options) {

Source/Forms/NetGraphForm.resx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,10 @@
121121
<value>17, 17</value>
122122
</metadata>
123123
<metadata name="trayIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124-
<value>271, 17</value>
124+
<value>97, 17</value>
125125
</metadata>
126126
<metadata name="trayMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
127-
<value>366, 17</value>
128-
</metadata>
129-
<metadata name="samplerBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
130-
<value>97, 17</value>
127+
<value>192, 17</value>
131128
</metadata>
132129
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
133130
<value>58</value>

Source/NetworkInterfaceSampler.cs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@
77
using System.Net.NetworkInformation;
88

99
namespace ScriptFUSION.UpDown_Meter {
10-
public class NetworkInterfaceSampler : INotifyPropertyChanged, IEnumerable<Sample> {
10+
public class NetworkInterfaceSampler : IEnumerable<Sample> {
1111
private NetworkInterface nic;
1212

13-
private ulong maximumSpeed;
14-
15-
private PropertyChangedEventHandler propertyChangedHandlers;
16-
1713
public delegate void SampleAddedDelegate(NetworkInterfaceSampler sampler, Sample sample);
1814

1915
public delegate void SamplesClearedDelegate(NetworkInterfaceSampler sampler);
@@ -22,12 +18,6 @@ public class NetworkInterfaceSampler : INotifyPropertyChanged, IEnumerable<Sampl
2218

2319
public event SamplesClearedDelegate SamplesCleared;
2420

25-
event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged
26-
{
27-
add { propertyChangedHandlers += value; }
28-
remove { propertyChangedHandlers -= value; }
29-
}
30-
3121
/// <summary>
3222
/// Collection of relative samples from the current NetworkInterface.
3323
/// </summary>
@@ -54,15 +44,7 @@ public NetworkInterface NetworkInterface
5444
/// <summary>
5545
/// List of relative samples.
5646
/// </summary>
57-
public ulong MaximumSpeed
58-
{
59-
get { return maximumSpeed; }
60-
set
61-
{
62-
maximumSpeed = value;
63-
RaisePropertyChanged();
64-
}
65-
}
47+
public ulong MaximumSpeed { get; set; }
6648

6749
public void Reset() {
6850
Samples.Clear();
@@ -106,10 +88,6 @@ private Sample CreateAbsoluteSample(IPInterfaceStatistics stats) {
10688
return new Sample(stats.BytesReceived, stats.BytesSent);
10789
}
10890

109-
private void RaisePropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string property = null) {
110-
propertyChangedHandlers?.Invoke(this, new PropertyChangedEventArgs(property));
111-
}
112-
11391
private void RaiseSampleAdded(Sample sample) {
11492
SampleAdded?.Invoke(this, sample);
11593
}

Source/Properties/DataSources/NetworkInterfaceSampler.datasource

Lines changed: 0 additions & 10 deletions
This file was deleted.

Source/UpDown Meter.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@
136136
<DesignTime>True</DesignTime>
137137
</Compile>
138138
<None Include="packages.config" />
139-
<None Include="Properties\DataSources\NetworkInterfaceSampler.datasource" />
140139
<None Include="Properties\Settings.settings">
141140
<Generator>SettingsSingleFileGenerator</Generator>
142141
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

0 commit comments

Comments
 (0)