Skip to content

Commit 3375dbb

Browse files
authored
Merge pull request #14 from Monbsoft/dev
[Meger] dev to master
2 parents b86621e + c7907d9 commit 3375dbb

16 files changed

+209
-74
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

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

.github/ISSUE_TEMPLATE/feature_request.md

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

src/MachineMonitor.Setup/MachineMonitor.Setup.vdproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5772,15 +5772,15 @@
57725772
{
57735773
"Name" = "8:Microsoft Visual Studio"
57745774
"ProductName" = "8:MachineMonitor"
5775-
"ProductCode" = "8:{34C0391C-F0AB-48EA-A866-DA434C86E217}"
5776-
"PackageCode" = "8:{5D8BAE24-EBBA-4B25-88B9-A4EE636BDEC5}"
5775+
"ProductCode" = "8:{18926866-857D-4E78-9011-7BDBECF88449}"
5776+
"PackageCode" = "8:{1E9DAF35-6DA2-4CA5-8D87-CFAB211E80C9}"
57775777
"UpgradeCode" = "8:{1DB3CEEF-D801-4795-8E91-27ABFB4EFF46}"
57785778
"AspNetVersion" = "8:4.0.30319.0"
57795779
"RestartWWWService" = "11:FALSE"
57805780
"RemovePreviousVersions" = "11:TRUE"
57815781
"DetectNewerInstalledVersion" = "11:TRUE"
57825782
"InstallAllUsers" = "11:FALSE"
5783-
"ProductVersion" = "8:1.0.1"
5783+
"ProductVersion" = "8:1.0.3"
57845784
"Manufacturer" = "8:Monbsoft"
57855785
"ARPHELPTELEPHONE" = "8:"
57865786
"ARPHELPLINK" = "8:"
@@ -6308,7 +6308,7 @@
63086308
{
63096309
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_A5CBE260681E4F25B804423F0E685811"
63106310
{
6311-
"SourcePath" = "8:..\\MachineMonitor\\obj\\Release\\MachineMonitor.exe"
6311+
"SourcePath" = "8:..\\MachineMonitor\\obj\\Debug\\MachineMonitor.exe"
63126312
"TargetName" = "8:"
63136313
"Tag" = "8:"
63146314
"Folder" = "8:_F9568AA8B4624F80A9DCDBFC3EFDE8AA"

src/MachineMonitor/App.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
<setting name="Disk" serializeAs="String">
2929
<value>_Total</value>
3030
</setting>
31+
<setting name="Topmost" serializeAs="String">
32+
<value>True</value>
33+
</setting>
3134
</Monbsoft.MachineMonitor.Properties.Settings>
3235
<Monbsoft.MachineMonitor.Settings>
3336
<setting name="Network" serializeAs="String">

src/MachineMonitor/Configuration/ConfigurationStore.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@ public string Network
3030
}
3131
}
3232

33+
public bool Topmost
34+
{
35+
get
36+
{
37+
return Settings.Default.Topmost;
38+
}
39+
set
40+
{
41+
Settings.Default.Topmost = value;
42+
Save();
43+
}
44+
}
45+
46+
3347
public bool Transparent
3448
{
3549
get
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Collections.Generic;
2+
3+
namespace Monbsoft.MachineMonitor.Helpers
4+
{
5+
public static class BitHelper
6+
{
7+
private static readonly Dictionary<int, string> byteUnits = new Dictionary<int, string>
8+
{
9+
{ 0, "bits/s" },
10+
{ 1, "Kbits/s" },
11+
{ 2, "Mbits/s" },
12+
{ 3, "Gbits/s" },
13+
{ 4, "Tbits/s" }
14+
};
15+
16+
public static string DisplayByte(double bytes)
17+
{
18+
int index = 0;
19+
bool find = false;
20+
21+
double rate = bytes * 8;
22+
double next;
23+
while (!find && index < 4)
24+
{
25+
next = rate / 1000;
26+
if (next >= 1.0d)
27+
{
28+
index++;
29+
rate = next;
30+
}
31+
else
32+
{
33+
find = true;
34+
}
35+
}
36+
return $"{rate.ToString("F1")} {byteUnits[index]}";
37+
}
38+
}
39+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Monbsoft.MachineMonitor.Helpers
8+
{
9+
public static class OctetHelper
10+
{
11+
private static readonly Dictionary<int, string> octetUnits = new Dictionary<int, string>
12+
{
13+
{0, "Mo" },
14+
{1, "Go" },
15+
{2, "To" },
16+
{3, "Po" }
17+
};
18+
public static string DisplayMega(double mega)
19+
{
20+
bool find = false;
21+
double value = mega;
22+
int index = 0;
23+
while(!find && index <3)
24+
{
25+
double next = value / 1024;
26+
if(next >= 1.0)
27+
{
28+
value = next;
29+
}
30+
else
31+
{
32+
index++;
33+
find = true;
34+
35+
}
36+
}
37+
38+
return $"{value.ToString("F1")} {octetUnits[index]}";
39+
}
40+
}
41+
}

src/MachineMonitor/MachineMonitor.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
<SubType>Designer</SubType>
7575
</ApplicationDefinition>
7676
<Compile Include="Configuration\ConfigurationStore.cs" />
77+
<Compile Include="Helpers\BitHelper.cs" />
78+
<Compile Include="Helpers\OctetHelper.cs" />
7779
<Compile Include="Messages\UpdatedConfigurationMessage.cs" />
7880
<Compile Include="Properties\Resource.Designer.cs">
7981
<AutoGen>True</AutoGen>
@@ -145,5 +147,6 @@
145147
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
146148
</EmbeddedResource>
147149
</ItemGroup>
150+
<ItemGroup />
148151
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
149152
</Project>

src/MachineMonitor/Messages/UpdatedConfigurationMessage.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public enum ChangedType
1515
{
1616
Disk = 0,
1717
Network = 1,
18-
Transparent = 2
18+
Transparent = 2,
19+
Topmost = 3
1920
}
2021

2122
public ChangedType Changed { get; set; }

src/MachineMonitor/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
5252
// en utilisant '*', comme indiqué ci-dessous :
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.0.2")]
55-
[assembly: AssemblyFileVersion("1.0.2")]
54+
[assembly: AssemblyVersion("1.0.3")]
55+
[assembly: AssemblyFileVersion("1.0.3")]

src/MachineMonitor/Properties/Settings.Designer.cs

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

src/MachineMonitor/Properties/Settings.settings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
<Setting Name="Disk" Type="System.String" Scope="User">
1212
<Value Profile="(Default)">_Total</Value>
1313
</Setting>
14+
<Setting Name="Topmost" Type="System.Boolean" Scope="User">
15+
<Value Profile="(Default)">True</Value>
16+
</Setting>
1417
</Settings>
1518
</SettingsFile>

src/MachineMonitor/ViewModels/ConfigurationViewModel.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class ConfigurationViewModel : ViewModelBase
1616
private string _disk;
1717
private string _network;
1818
private bool _transparent;
19+
private bool _topmost;
1920
#endregion
2021

2122
#region Constructeurs
@@ -88,6 +89,19 @@ public bool Transparent
8889
Transparent_Changed();
8990
}
9091
}
92+
93+
public bool Topmost
94+
{
95+
get
96+
{
97+
return _topmost;
98+
}
99+
set
100+
{
101+
Set(ref _topmost, value);
102+
Topmost_Changed();
103+
}
104+
}
91105
#endregion
92106

93107
#region Méthodes
@@ -111,6 +125,12 @@ private void Transparent_Changed()
111125
_configuration.Transparent = _transparent;
112126
SendMessage(ChangedType.Transparent);
113127
}
128+
129+
private void Topmost_Changed()
130+
{
131+
_configuration.Topmost = _topmost;
132+
SendMessage(ChangedType.Topmost);
133+
}
114134
#endregion
115135
}
116136
}

0 commit comments

Comments
 (0)