diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageEditor.cs b/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageEditor.cs index 9f82501..38b6571 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageEditor.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageEditor.cs @@ -23,7 +23,7 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon if (editorDialog.ShowDialog() == DialogResult.OK) { - configureHeadstage.Bno055.Enable = editorDialog.DialogBno055.ConfigureNode.Enable; + configureHeadstage.Bno055.Enable = editorDialog.DialogBno055.Bno055.Enable; configureHeadstage.NeuropixelsV1e.AdcCalibrationFile = editorDialog.DialogNeuropixelsV1e.ConfigureNode.AdcCalibrationFile; configureHeadstage.NeuropixelsV1e.GainCalibrationFile = editorDialog.DialogNeuropixelsV1e.ConfigureNode.GainCalibrationFile; diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.cs index 7c6bac0..189aa1e 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.cs @@ -31,7 +31,7 @@ public partial class NeuropixelsV1fHeadstageDialog : Form /// /// Configuration settings for A. /// Configuration settings for B - /// Configuration settings for a . + /// Configuration settings for a . public NeuropixelsV1fHeadstageDialog(ConfigureNeuropixelsV1f configureNeuropixelsV1A, ConfigureNeuropixelsV1f configureNeuropixelsV1B, ConfigureBno055 configureBno055) { InitializeComponent(); diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageEditor.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageEditor.cs index 5667456..ed4c118 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageEditor.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageEditor.cs @@ -23,7 +23,7 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon if (editorDialog.ShowDialog() == DialogResult.OK) { - configureV2eHeadstage.Bno055.Enable = editorDialog.DialogBno055.ConfigureNode.Enable; + configureV2eHeadstage.Bno055.Enable = editorDialog.DialogBno055.Bno055.Enable; configureV2eHeadstage.NeuropixelsV2e.Enable = editorDialog.DialogNeuropixelsV2e.ConfigureNode.Enable; configureV2eHeadstage.NeuropixelsV2e.ProbeConfigurationA = editorDialog.DialogNeuropixelsV2e.ConfigureNode.ProbeConfigurationA; @@ -40,7 +40,7 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon if (editorDialog.ShowDialog() == DialogResult.OK) { - configureV2eBetaHeadstage.Bno055.Enable = editorDialog.DialogBno055.ConfigureNode.Enable; + configureV2eBetaHeadstage.Bno055.Enable = editorDialog.DialogBno055.Bno055.Enable; configureV2eBetaHeadstage.NeuropixelsV2eBeta.Enable = editorDialog.DialogNeuropixelsV2e.ConfigureNode.Enable; configureV2eBetaHeadstage.NeuropixelsV2eBeta.ProbeConfigurationA = editorDialog.DialogNeuropixelsV2e.ConfigureNode.ProbeConfigurationA; diff --git a/OpenEphys.Onix1.Design/PolledBno055Dialog.cs b/OpenEphys.Onix1.Design/PolledBno055Dialog.cs index 0ed7b47..74764b3 100644 --- a/OpenEphys.Onix1.Design/PolledBno055Dialog.cs +++ b/OpenEphys.Onix1.Design/PolledBno055Dialog.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; namespace OpenEphys.Onix1.Design { @@ -11,23 +12,32 @@ public partial class PolledBno055Dialog : GenericDeviceDialog /// Gets or sets the object attached to /// the property grid. /// - public ConfigurePolledBno055 ConfigureNode - { - get => (ConfigurePolledBno055)propertyGrid.SelectedObject; - set => propertyGrid.SelectedObject = value; - } + internal InternalPolledBno055 Bno055 { get; set; } /// /// Initializes a new instance with the given /// object. /// /// A object that contains configuration settings. - public PolledBno055Dialog(ConfigurePolledBno055 configureNode) + /// + /// Boolean that is true if this should be allowed to + /// edit the and + /// properties. It is set to false when called from headstage editors. + public PolledBno055Dialog(ConfigurePolledBno055 configureNode, bool allFieldsEditable = false) { InitializeComponent(); Shown += FormShown; - ConfigureNode = new(configureNode); + Bno055 = new(configureNode); + + if (allFieldsEditable) + { + propertyGrid.SelectedObject = Bno055.Bno055; + } + else + { + propertyGrid.SelectedObject = Bno055; + } } private void FormShown(object sender, EventArgs e) @@ -41,4 +51,25 @@ private void FormShown(object sender, EventArgs e) } } } + + internal class InternalPolledBno055 + { + [TypeConverter(typeof(PolledBno055SingleDeviceFactoryConverter))] + [Category(DeviceFactory.ConfigurationCategory)] + public ConfigurePolledBno055 Bno055 { get; set; } + + public InternalPolledBno055(ConfigurePolledBno055 polledBno) + { + Bno055 = polledBno; + } + + [Browsable(false)] + public bool Enable { get => Bno055.Enable; } + + [Browsable(false)] + public string DeviceName { get => Bno055.DeviceName; } + + [Browsable(false)] + public uint DeviceAddress { get => Bno055.DeviceAddress; } + } } diff --git a/OpenEphys.Onix1.Design/PolledBno055Editor.cs b/OpenEphys.Onix1.Design/PolledBno055Editor.cs index bef16bb..9664648 100644 --- a/OpenEphys.Onix1.Design/PolledBno055Editor.cs +++ b/OpenEphys.Onix1.Design/PolledBno055Editor.cs @@ -14,13 +14,15 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon var editorState = (IWorkflowEditorState)provider.GetService(typeof(IWorkflowEditorState)); if (editorState != null && !editorState.WorkflowRunning && component is ConfigurePolledBno055 configureBno055) { - using var editorDialog = new PolledBno055Dialog(configureBno055); + using var editorDialog = new PolledBno055Dialog(configureBno055, true); if (editorDialog.ShowDialog() == DialogResult.OK) { - configureBno055.Enable = editorDialog.ConfigureNode.Enable; - configureBno055.DeviceAddress = editorDialog.ConfigureNode.DeviceAddress; - configureBno055.DeviceName = editorDialog.ConfigureNode.DeviceName; + configureBno055.Enable = editorDialog.Bno055.Enable; + configureBno055.DeviceAddress = editorDialog.Bno055.DeviceAddress; + configureBno055.DeviceName = editorDialog.Bno055.DeviceName; + configureBno055.AxisMap = editorDialog.Bno055.Bno055.AxisMap; + configureBno055.AxisSign = editorDialog.Bno055.Bno055.AxisSign; return true; } diff --git a/OpenEphys.Onix1/ConfigurePolledBno055.cs b/OpenEphys.Onix1/ConfigurePolledBno055.cs index 3bbda70..6996954 100644 --- a/OpenEphys.Onix1/ConfigurePolledBno055.cs +++ b/OpenEphys.Onix1/ConfigurePolledBno055.cs @@ -1,6 +1,9 @@ using System; using System.ComponentModel; using System.Linq; +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("OpenEphys.Onix1.Design")] namespace OpenEphys.Onix1 {