Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions LogicSandbox/Forms/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,24 @@
using Maxstupo.LogicSandbox.Logic;
using Maxstupo.LogicSandbox.Logic.Components;
using Maxstupo.LogicSandbox.Properties;
using Maxstupo.LogicSandbox.Shapes;
using Maxstupo.LogicSandbox.Utility.Interaction;

public partial class FormMain : Form {

private Version Version => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
private string DisplayVersion {
get {
Version version = Version;

string displayVersion = $"v{version.Major}.{version.Minor}.{version.Build}";

if (version.Revision != 0)
displayVersion += $".{version.Revision}";

return displayVersion;
}
}


private Circuit circuit = new Circuit();
private readonly CircuitSimulator simulator = new CircuitSimulator();

Expand Down Expand Up @@ -50,6 +63,8 @@ public FormMain() {
simulator.Circuit = circuit;
simulator.OnUpsChanged += (s, e) => Invoke((MethodInvoker) delegate { UpdateStatusBar(); });
simulator.OnStateChange += (s, e) => Invoke((MethodInvoker) delegate { canvas.Refresh(); });

UpdateTitle();
}

private void UpdateStatusBar() {
Expand All @@ -60,10 +75,12 @@ private void UpdateStatusBar() {
}

private void UpdateTitle() {
string version = DisplayVersion;

if (openFilepath == null) {
Text = "Logic Sandbox";
Text = $"Logic Sandbox {version}";
} else {
Text = $"Logic Sandbox - {openFilepath}{(UnsavedChanges ? "*" : string.Empty)}";
Text = $"Logic Sandbox {version} - {openFilepath}{(UnsavedChanges ? "*" : string.Empty)}";
}
}

Expand Down Expand Up @@ -225,7 +242,7 @@ private void createICToolStripMenuItem_Click(object sender, EventArgs e) {
private void toggleSimulationTsmi_Click(object sender, EventArgs e) {
simulator.Toggle();

stepSimulationTsmi.Enabled = !simulator.IsRunning;
stepSimulationTsmi.Enabled = !simulator.IsRunning;
speedTsmi.Enabled = simulator.IsRunning;

toggleSimulationTsmi.Text = simulator.IsRunning ? "&Pause" : "&Play";
Expand Down
7 changes: 2 additions & 5 deletions LogicSandbox/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,5 @@
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]