diff --git a/Bonsai.Editor/EditorForm.Designer.cs b/Bonsai.Editor/EditorForm.Designer.cs
index 3c99e6e7..e429d62b 100644
--- a/Bonsai.Editor/EditorForm.Designer.cs
+++ b/Bonsai.Editor/EditorForm.Designer.cs
@@ -1,4 +1,4 @@
-namespace Bonsai.Editor
+namespace Bonsai.Editor
{
partial class EditorForm
{
@@ -72,6 +72,8 @@ private void InitializeComponent()
this.startWithoutDebuggingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.stopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restartToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
+ this.watchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.packageManagerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.galleryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -470,7 +472,9 @@ private void InitializeComponent()
this.startToolStripMenuItem,
this.startWithoutDebuggingToolStripMenuItem,
this.stopToolStripMenuItem,
- this.restartToolStripMenuItem});
+ this.restartToolStripMenuItem,
+ this.toolStripSeparator11,
+ this.watchToolStripMenuItem});
this.workflowToolStripMenuItem.Name = "workflowToolStripMenuItem";
this.workflowToolStripMenuItem.Size = new System.Drawing.Size(70, 20);
this.workflowToolStripMenuItem.Text = "&Workflow";
@@ -518,6 +522,21 @@ private void InitializeComponent()
this.restartToolStripMenuItem.Visible = false;
this.restartToolStripMenuItem.Click += new System.EventHandler(this.restartToolStripMenuItem_Click);
//
+ // toolStripSeparator11
+ //
+ this.toolStripSeparator11.Name = "toolStripSeparator11";
+ this.toolStripSeparator11.Size = new System.Drawing.Size(249, 6);
+ //
+ // watchToolStripMenuItem
+ //
+ this.watchToolStripMenuItem.Checked = true;
+ this.watchToolStripMenuItem.CheckOnClick = true;
+ this.watchToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.watchToolStripMenuItem.Image = global::Bonsai.Editor.Properties.Resources.WatchMenuImage;
+ this.watchToolStripMenuItem.Name = "watchToolStripMenuItem";
+ this.watchToolStripMenuItem.Size = new System.Drawing.Size(252, 22);
+ this.watchToolStripMenuItem.Text = "&Watch";
+ //
// toolsToolStripMenuItem
//
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -1500,6 +1519,8 @@ private void InitializeComponent()
private System.Windows.Forms.ContextMenuStrip statusContextMenuStrip;
private System.Windows.Forms.ToolStripMenuItem statusCopyToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolboxDocsToolStripMenuItem;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator11;
+ private System.Windows.Forms.ToolStripMenuItem watchToolStripMenuItem;
}
}
diff --git a/Bonsai.Editor/EditorForm.cs b/Bonsai.Editor/EditorForm.cs
index 2f99b24a..645f9504 100644
--- a/Bonsai.Editor/EditorForm.cs
+++ b/Bonsai.Editor/EditorForm.cs
@@ -1187,6 +1187,7 @@ IDisposable ShutdownSequence()
groupToolStripMenuItem.Enabled = true;
cutToolStripMenuItem.Enabled = true;
pasteToolStripMenuItem.Enabled = true;
+ watchToolStripMenuItem.Enabled = true;
startToolStripSplitButton.Enabled = startToolStripMenuItem.Enabled = startWithoutDebuggingToolStripMenuItem.Enabled = true;
stopToolStripButton.Visible = stopToolStripMenuItem.Visible = stopToolStripButton.Enabled = stopToolStripMenuItem.Enabled = false;
restartToolStripButton.Visible = restartToolStripMenuItem.Visible = restartToolStripButton.Enabled = restartToolStripMenuItem.Enabled = false;
@@ -1226,7 +1227,8 @@ void StartWorkflow(bool debug)
var runtimeWorkflow = workflowBuilder.Workflow.BuildObservable();
Invoke((Action)(() =>
{
- if (debug) workflowWatch.Start(workflowBuilder.Workflow);
+ if (watchToolStripMenuItem.Checked)
+ workflowWatch.Start(workflowBuilder.Workflow);
statusTextLabel.Text = Resources.RunningStatus;
statusImageLabel.Image = statusRunningImage;
editorSite.OnWorkflowStarted(EventArgs.Empty);
@@ -1259,6 +1261,7 @@ void StartWorkflow(bool debug)
groupToolStripMenuItem.Enabled = false;
cutToolStripMenuItem.Enabled = false;
pasteToolStripMenuItem.Enabled = false;
+ watchToolStripMenuItem.Enabled = false;
startToolStripSplitButton.Enabled = startToolStripMenuItem.Enabled = startWithoutDebuggingToolStripMenuItem.Enabled = false;
stopToolStripButton.Visible = stopToolStripMenuItem.Visible = stopToolStripButton.Enabled = stopToolStripMenuItem.Enabled = true;
restartToolStripButton.Visible = restartToolStripMenuItem.Visible = restartToolStripButton.Enabled = restartToolStripMenuItem.Enabled = true;
@@ -2214,6 +2217,15 @@ private void disableToolStripMenuItem_Click(object sender, EventArgs e)
#endregion
+ #region Watch
+
+ private void watchToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ workflowWatch.Enabled = watchToolStripMenuItem.Checked;
+ }
+
+ #endregion
+
#region Undo/Redo
private void commandExecutor_StatusChanged(object sender, EventArgs e)
diff --git a/Bonsai.Editor/GraphView/WorkflowGraphView.cs b/Bonsai.Editor/GraphView/WorkflowGraphView.cs
index 09c92d51..b6ac60c2 100644
--- a/Bonsai.Editor/GraphView/WorkflowGraphView.cs
+++ b/Bonsai.Editor/GraphView/WorkflowGraphView.cs
@@ -105,7 +105,12 @@ private void WorkflowWatch_Tick(object sender, EventArgs e)
if (node.Value is null)
continue;
- if (workflowWatch.Counters?.TryGetValue(node.Value, out var counter) is true)
+ if (!workflowWatch.Enabled)
+ {
+ node.Status = null;
+ node.NotifyingCounter = -1;
+ }
+ else if (workflowWatch.Counters?.TryGetValue(node.Value, out var counter) is true)
{
node.Status = counter.GetStatus();
if (node.Status == WorkflowElementStatus.Notifying)
@@ -117,11 +122,6 @@ private void WorkflowWatch_Tick(object sender, EventArgs e)
node.NotifyingCounter = -1;
}
}
- else
- {
- node.Status = null;
- node.NotifyingCounter = -1;
- }
}
}
}
diff --git a/Bonsai.Editor/Properties/Resources.Designer.cs b/Bonsai.Editor/Properties/Resources.Designer.cs
index 295eb181..7ff5b62c 100644
--- a/Bonsai.Editor/Properties/Resources.Designer.cs
+++ b/Bonsai.Editor/Properties/Resources.Designer.cs
@@ -602,6 +602,16 @@ internal static string VisualizerLayoutOnNullWorkflow_Error {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap WatchMenuImage {
+ get {
+ object obj = ResourceManager.GetObject("WatchMenuImage", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Looks up a localized string similar to Externalized properties of this workflow can be configured below..
///
diff --git a/Bonsai.Editor/Properties/Resources.resx b/Bonsai.Editor/Properties/Resources.resx
index d5b31a13..3bd3856c 100644
--- a/Bonsai.Editor/Properties/Resources.resx
+++ b/Bonsai.Editor/Properties/Resources.resx
@@ -341,4 +341,14 @@ NOTE: You will have to restart Bonsai for any changes to take effect.
Help
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
+ JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAA7CAAAOwgEVKEqAAAAAv0lE
+ QVQ4T2MYRkBRUTEJiPeDMFQIBcDkQOqgQgggIyMjpKCgsElKSkoYKoQV4FQnLy+fBcJQLl6AoZZY22EA
+ Qz0ptsMAih6gaY+AAfMfC34AkgfRaOJgDNIHNgDI+SsnJyeJjpEV45D/BzYAaNILoHMMkCWB/ACg+FWo
+ BRdAfGR5ZWVlI6D4c5gB24A4HlkBkL8aqKkAakAOiI8sD5RLBIptgRmQB3ImMgaKvQKFNkgeqEEQxMei
+ Jg9swFAHDAwAKi9WPOw18+QAAAAASUVORK5CYII=
+
+
\ No newline at end of file
diff --git a/Bonsai.Editor/WorkflowWatch.cs b/Bonsai.Editor/WorkflowWatch.cs
index 1b38d8bf..03dccae8 100644
--- a/Bonsai.Editor/WorkflowWatch.cs
+++ b/Bonsai.Editor/WorkflowWatch.cs
@@ -11,10 +11,22 @@ internal class WorkflowWatch
const int WatchPeriod = 100;
readonly Timer watchTimer = new() { Interval = WatchPeriod };
WorkflowMeter workflowMeter;
+ bool enabled;
public WorkflowWatch()
{
watchTimer.Tick += (_, e) => OnUpdate(e);
+ enabled = true;
+ }
+
+ public bool Enabled
+ {
+ get => enabled;
+ set
+ {
+ enabled = value;
+ OnUpdate(EventArgs.Empty);
+ }
}
public event EventHandler Update;
@@ -45,10 +57,10 @@ public void Stop()
watchTimer.Stop();
if (workflowMeter is not null)
{
+ OnUpdate(EventArgs.Empty);
workflowMeter.Dispose();
workflowMeter = null;
}
- OnUpdate(EventArgs.Empty);
}
}
}