Skip to content

Commit bfa7251

Browse files
committed
Add PropertyGrid to stimulus sequence dialogs
1 parent 8e0f8cd commit bfa7251

8 files changed

+194
-84
lines changed

OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.Designer.cs

Lines changed: 69 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.cs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ namespace OpenEphys.Onix1.Design
1212
/// </summary>
1313
public partial class GenericStimulusSequenceDialog : Form
1414
{
15+
internal object Device
16+
{
17+
get => propertyGrid.SelectedObject;
18+
set => propertyGrid.SelectedObject = value;
19+
}
20+
1521
readonly int NumberOfChannels;
1622
readonly bool UseProbeGroup;
1723
readonly bool UseTable;
@@ -29,23 +35,26 @@ public partial class GenericStimulusSequenceDialog : Form
2935
}
3036

3137
/// <summary>
32-
/// Opens a dialog allowing for easy changing of stimulus sequence parameters, with visual feedback on what the resulting stimulus sequence looks like.
38+
/// Opens a dialog allowing for easy changing of stimulus sequence parameters,
39+
/// with visual feedback on what the resulting stimulus sequence looks like.
3340
/// </summary>
34-
public GenericStimulusSequenceDialog(int numberOfChannels, bool useProbeGroup, bool useTable = false)
41+
public GenericStimulusSequenceDialog(object device, int numberOfChannels, bool useProbeGroup, bool useTable = false)
3542
{
3643
InitializeComponent();
3744
Shown += FormShown;
3845

46+
Device = device;
47+
3948
NumberOfChannels = numberOfChannels;
4049
UseProbeGroup = useProbeGroup;
4150
UseTable = useTable;
4251

4352
if (!UseProbeGroup)
4453
{
4554
tableLayoutPanel1.Controls.Remove(panelProbe);
46-
GroupBox gb = tableLayoutPanel1.Controls[nameof(groupBoxDefineStimuli)] as GroupBox;
47-
tableLayoutPanel1.SetRow(gb, 0);
48-
tableLayoutPanel1.SetRowSpan(gb, 2);
55+
var control = tableLayoutPanel1.Controls[nameof(tabControlProperties)] as TabControl;
56+
tableLayoutPanel1.SetRow(control, 0);
57+
tableLayoutPanel1.SetRowSpan(control, 3);
4958
}
5059

5160
if (!UseTable)
@@ -524,5 +533,12 @@ void ResetZoom()
524533
zedGraphWaveform.Refresh();
525534
}
526535

536+
void PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
537+
{
538+
var propertyGrid = (PropertyGrid)s;
539+
UpdateControls(propertyGrid.SelectedObject);
540+
}
541+
542+
internal virtual void UpdateControls(object obj) { throw new NotImplementedException(); }
527543
}
528544
}

OpenEphys.Onix1.Design/Headstage64Dialog.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorOptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public Headstage64ElectricalStimulatorOptions()
2121
/// <param name="electricalStimulator"></param>
2222
public Headstage64ElectricalStimulatorOptions(ConfigureHeadstage64ElectricalStimulator electricalStimulator)
2323
: this()
24+
{
25+
UpdateControls(electricalStimulator);
26+
}
27+
28+
internal void UpdateControls(ConfigureHeadstage64ElectricalStimulator electricalStimulator)
2429
{
2530
textBoxPhaseOneCurrent.Text = electricalStimulator.PhaseOneCurrent.ToString();
2631
textBoxPhaseOneDuration.Text = electricalStimulator.PhaseOneDuration.ToString();

0 commit comments

Comments
 (0)