Skip to content

Commit f801d21

Browse files
authored
Merge pull request #16 from Maxstupo/develop
Add version to window title. (closes #7)
2 parents 3bd6a25 + c80f629 commit f801d21

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

LogicSandbox/Forms/FormMain.cs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,24 @@
1313
using Maxstupo.LogicSandbox.Logic;
1414
using Maxstupo.LogicSandbox.Logic.Components;
1515
using Maxstupo.LogicSandbox.Properties;
16-
using Maxstupo.LogicSandbox.Shapes;
17-
using Maxstupo.LogicSandbox.Utility.Interaction;
1816

1917
public partial class FormMain : Form {
2018

19+
private Version Version => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
20+
private string DisplayVersion {
21+
get {
22+
Version version = Version;
23+
24+
string displayVersion = $"v{version.Major}.{version.Minor}.{version.Build}";
25+
26+
if (version.Revision != 0)
27+
displayVersion += $".{version.Revision}";
28+
29+
return displayVersion;
30+
}
31+
}
32+
33+
2134
private Circuit circuit = new Circuit();
2235
private readonly CircuitSimulator simulator = new CircuitSimulator();
2336

@@ -50,6 +63,8 @@ public FormMain() {
5063
simulator.Circuit = circuit;
5164
simulator.OnUpsChanged += (s, e) => Invoke((MethodInvoker) delegate { UpdateStatusBar(); });
5265
simulator.OnStateChange += (s, e) => Invoke((MethodInvoker) delegate { canvas.Refresh(); });
66+
67+
UpdateTitle();
5368
}
5469

5570
private void UpdateStatusBar() {
@@ -60,10 +75,12 @@ private void UpdateStatusBar() {
6075
}
6176

6277
private void UpdateTitle() {
78+
string version = DisplayVersion;
79+
6380
if (openFilepath == null) {
64-
Text = "Logic Sandbox";
81+
Text = $"Logic Sandbox {version}";
6582
} else {
66-
Text = $"Logic Sandbox - {openFilepath}{(UnsavedChanges ? "*" : string.Empty)}";
83+
Text = $"Logic Sandbox {version} - {openFilepath}{(UnsavedChanges ? "*" : string.Empty)}";
6784
}
6885
}
6986

@@ -225,7 +242,7 @@ private void createICToolStripMenuItem_Click(object sender, EventArgs e) {
225242
private void toggleSimulationTsmi_Click(object sender, EventArgs e) {
226243
simulator.Toggle();
227244

228-
stepSimulationTsmi.Enabled = !simulator.IsRunning;
245+
stepSimulationTsmi.Enabled = !simulator.IsRunning;
229246
speedTsmi.Enabled = simulator.IsRunning;
230247

231248
toggleSimulationTsmi.Text = simulator.IsRunning ? "&Pause" : "&Play";

LogicSandbox/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,5 @@
2929
// Build Number
3030
// Revision
3131
//
32-
// You can specify all the values or you can default the Build and Revision Numbers
33-
// by using the '*' as shown below:
34-
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.0.0.0")]
32+
[assembly: AssemblyVersion("0.1.0.0")]
33+
[assembly: AssemblyFileVersion("0.1.0.0")]

0 commit comments

Comments
 (0)