Hide various things based on whether we can do Replays, and if we have anything to replay
This commit is contained in:
parent
0ac9fea3bb
commit
de5a3c353e
@ -14,6 +14,7 @@ namespace EduNetworkBuilder
|
||||
NetworkAction CurrentNetAction = null;
|
||||
|
||||
public Network GetNet { get { return StartingState; } }
|
||||
public int GetActionCount { get { if (CurrentNetAction == null) return 0; return CurrentNetAction.Actions.Count; } }
|
||||
|
||||
public void RegisterNet(Network starting)
|
||||
{
|
||||
|
17
EduNetworkBuilder/NetworkBuilder.Designer.cs
generated
17
EduNetworkBuilder/NetworkBuilder.Designer.cs
generated
@ -36,6 +36,7 @@
|
||||
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.logoutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.replayToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@ -78,7 +79,6 @@
|
||||
this.myProgressBar = new System.Windows.Forms.ProgressBar();
|
||||
this.cbLineColor = new System.Windows.Forms.ComboBox();
|
||||
this.cbFillColor = new System.Windows.Forms.ComboBox();
|
||||
this.replayToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.msMainMenuStrip.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbNetworkView)).BeginInit();
|
||||
this.HelpPanel.SuspendLayout();
|
||||
@ -113,6 +113,7 @@
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24);
|
||||
this.fileToolStripMenuItem.Text = "File";
|
||||
this.fileToolStripMenuItem.DropDownOpening += new System.EventHandler(this.fileToolStripMenuItem_DropDownOpening);
|
||||
//
|
||||
// newToolStripMenuItem
|
||||
//
|
||||
@ -156,6 +157,13 @@
|
||||
this.exitToolStripMenuItem.Text = "Exit";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||
//
|
||||
// replayToolStripMenuItem
|
||||
//
|
||||
this.replayToolStripMenuItem.Name = "replayToolStripMenuItem";
|
||||
this.replayToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
|
||||
this.replayToolStripMenuItem.Text = "Replay";
|
||||
this.replayToolStripMenuItem.Click += new System.EventHandler(this.replayToolStripMenuItem_Click);
|
||||
//
|
||||
// editToolStripMenuItem
|
||||
//
|
||||
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
@ -535,13 +543,6 @@
|
||||
this.cbFillColor.Size = new System.Drawing.Size(80, 24);
|
||||
this.cbFillColor.TabIndex = 13;
|
||||
//
|
||||
// replayToolStripMenuItem
|
||||
//
|
||||
this.replayToolStripMenuItem.Name = "replayToolStripMenuItem";
|
||||
this.replayToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
|
||||
this.replayToolStripMenuItem.Text = "Replay";
|
||||
this.replayToolStripMenuItem.Click += new System.EventHandler(this.replayToolStripMenuItem_Click);
|
||||
//
|
||||
// BuilderWindow
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
|
@ -2804,6 +2804,8 @@ namespace EduNetworkBuilder
|
||||
// Go through each step and do the actions again in order
|
||||
NBSettings ourSettings = NB.GetSettings();
|
||||
if (OurSettings == null) return; //nothing to do
|
||||
if (OurSettings.ReplayMode == false) return; //We should never be here if we are false.
|
||||
|
||||
ActionCollection actions = OurSettings.GetUserActionCollection();
|
||||
if (actions == null) return; //nothing to do
|
||||
|
||||
@ -2823,5 +2825,23 @@ namespace EduNetworkBuilder
|
||||
myNetwork.NextReplayIndex = 0;
|
||||
myNetwork.NextReplayAction = DateTime.UtcNow.AddMilliseconds(NB.MillisecondsBetweenReplays);
|
||||
}
|
||||
|
||||
private void fileToolStripMenuItem_DropDownOpening(object sender, EventArgs e)
|
||||
{
|
||||
NBSettings ourSettings = NB.GetSettings();
|
||||
replayToolStripMenuItem.Visible = false;
|
||||
|
||||
if (OurSettings != null && OurSettings.ReplayMode)
|
||||
{
|
||||
ActionCollection AC = OurSettings.GetUserActionCollection();
|
||||
if(AC != null && AC.GetActionCount >0)
|
||||
replayToolStripMenuItem.Visible = true; //Only visible if we have something to replay
|
||||
}
|
||||
else
|
||||
{
|
||||
replayToolStripMenuItem.Visible = false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user