From e4c7d29d755d5034c6185aa2ba61959357297f1b Mon Sep 17 00:00:00 2001 From: glopesdev Date: Sun, 17 Dec 2023 20:52:02 +0000 Subject: [PATCH] Add property grid view configuration properties --- src/Aeon.Environment/Aeon.Environment.csproj | 2 +- src/Aeon.Environment/ExperimentProperties.cs | 7 +++++++ src/Aeon.Environment/ExperimentPropertiesVisualizer.cs | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Aeon.Environment/Aeon.Environment.csproj b/src/Aeon.Environment/Aeon.Environment.csproj index b3006f0..368a74a 100644 --- a/src/Aeon.Environment/Aeon.Environment.csproj +++ b/src/Aeon.Environment/Aeon.Environment.csproj @@ -7,7 +7,7 @@ Bonsai Rx Project Aeon Environment net472 0.1.0 - build231208 + build231209 diff --git a/src/Aeon.Environment/ExperimentProperties.cs b/src/Aeon.Environment/ExperimentProperties.cs index dad48af..a46df10 100644 --- a/src/Aeon.Environment/ExperimentProperties.cs +++ b/src/Aeon.Environment/ExperimentProperties.cs @@ -1,10 +1,17 @@ using Bonsai; using Bonsai.Expressions; +using System.ComponentModel; namespace Aeon.Environment { [TypeVisualizer(typeof(ExternalizedPropertiesVisualizer))] + [Description("Provides a configurable visualizer for global workflow properties.")] public class ExperimentProperties : UnitBuilder { + [Description("Specifies whether the help text box is visible.")] + public bool HelpVisible { get; set; } = true; + + [Description("Specifies whether the toolbar is visible.")] + public bool ToolbarVisible { get; set; } = true; } } diff --git a/src/Aeon.Environment/ExperimentPropertiesVisualizer.cs b/src/Aeon.Environment/ExperimentPropertiesVisualizer.cs index 1359da9..0f3cf88 100644 --- a/src/Aeon.Environment/ExperimentPropertiesVisualizer.cs +++ b/src/Aeon.Environment/ExperimentPropertiesVisualizer.cs @@ -1,5 +1,6 @@ using Bonsai; using Bonsai.Design; +using Bonsai.Expressions; using System; using System.Drawing; @@ -12,8 +13,13 @@ public sealed class ExternalizedPropertiesVisualizer : DialogTypeVisualizer public override void Load(IServiceProvider provider) { var workflowBuilder = (WorkflowBuilder)provider.GetService(typeof(WorkflowBuilder)); + var context = (ITypeVisualizerContext)provider.GetService(typeof(ITypeVisualizerContext)); + var visualizerElement = ExpressionBuilder.GetVisualizerElement(context.Source); + var source = (ExperimentProperties)ExpressionBuilder.GetWorkflowElement(visualizerElement.Builder); control = new PropertyGrid(); + control.HelpVisible = source.HelpVisible; + control.ToolbarVisible = source.ToolbarVisible; control.Font = new Font(control.Font.FontFamily, 16.2F); control.Dock = System.Windows.Forms.DockStyle.Fill; control.SelectedObject = workflowBuilder.Workflow;