Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

Commit

Permalink
display version info in the settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjorn committed Sep 28, 2016
1 parent 4cf7dd1 commit 7477c60
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 20 deletions.
18 changes: 18 additions & 0 deletions FloatingGlucose/Classes/AppShared.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
Expand All @@ -12,6 +13,23 @@ class AppShared
{
public static bool IsWorkStationLocked = false;
public static readonly string AppName = typeof(Program).Assembly.GetName().Name;
public static string AppVersion {
get
{
try
{
using (var reader = File.OpenText(Path.Combine(AppShared.ExecutableDir, "version.txt")))
{
return reader.ReadToEnd();
}
} catch (IOException) {
return "unknown";
}
}

}
public static string ExecutableDir => Path.GetDirectoryName(Application.ExecutablePath);

public static bool SettingsFormShouldFocusAdvancedSettings = false;
public static bool SettingsUpdatedSuccessfully = false;

Expand Down
55 changes: 35 additions & 20 deletions FloatingGlucose/FormGlucoseSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions FloatingGlucose/FormGlucoseSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand Down Expand Up @@ -110,6 +111,12 @@ private void FormGlucoseSettings_Load(object sender, EventArgs e)
this.updateFormControlsFromSettings();
this.FormClosing += this.OnClosing;


this.lblVersionInfo.Text = "Version: " + AppShared.AppVersion;
this.lblVersionInfo.Enabled = true;



//different increments for mmol/L and mg/dL
var controls = this.grpAlarmSettings.Controls.OfType<NumericUpDown>()
.Where(x=> x.DecimalPlaces == 1).ToList();
Expand All @@ -118,6 +125,9 @@ private void FormGlucoseSettings_Load(object sender, EventArgs e)
x.ValueChanged += new System.EventHandler(this.NumericUpDowns_Value_Changed);
});




if (AppShared.SettingsFormShouldFocusAdvancedSettings)
{
AppShared.SettingsFormShouldFocusAdvancedSettings = false;
Expand Down

0 comments on commit 7477c60

Please sign in to comment.