Skip to content

Commit

Permalink
Add dialogs for NeuropixelsV1f
Browse files Browse the repository at this point in the history
- Made NeuropixelsV1 dialogs more generalized, so they can be shared between V1e and V1f
- Added V1 Probe Configuration to match V2 to aid in modularity of dialogs
  • Loading branch information
bparks13 committed Oct 2, 2024
1 parent edc48dd commit cea6b89
Show file tree
Hide file tree
Showing 23 changed files with 4,490 additions and 279 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace OpenEphys.Onix1.Design
/// <summary>
/// Partial class to create a channel configuration GUI for the <see cref="ConfigureNeuropixelsV2e"/> class.
/// </summary>
public partial class NeuropixelsV1eChannelConfigurationDialog : ChannelConfigurationDialog
public partial class NeuropixelsV1ChannelConfigurationDialog : ChannelConfigurationDialog
{
internal event EventHandler OnZoom;
internal event EventHandler OnFileLoad;
Expand All @@ -20,15 +20,15 @@ public partial class NeuropixelsV1eChannelConfigurationDialog : ChannelConfigura

/// <summary>
/// Public <see cref="NeuropixelsV1ProbeConfiguration"/> object that is modified by
/// <see cref="NeuropixelsV1eChannelConfigurationDialog"/>.
/// <see cref="NeuropixelsV1ChannelConfigurationDialog"/>.
/// </summary>
public NeuropixelsV1ProbeConfiguration ProbeConfiguration { get; set; }

/// <summary>
/// Initializes a new instance of <see cref="NeuropixelsV1eChannelConfigurationDialog"/>.
/// Initializes a new instance of <see cref="NeuropixelsV1ChannelConfigurationDialog"/>.
/// </summary>
/// <param name="probeConfiguration">A <see cref="NeuropixelsV1ProbeConfiguration"/> object holding the current configuration settings.</param>
public NeuropixelsV1eChannelConfigurationDialog(NeuropixelsV1ProbeConfiguration probeConfiguration)
public NeuropixelsV1ChannelConfigurationDialog(NeuropixelsV1ProbeConfiguration probeConfiguration)
: base(probeConfiguration.ChannelConfiguration)
{
zedGraphChannels.ZoomButtons = MouseButtons.None;
Expand Down
153 changes: 153 additions & 0 deletions OpenEphys.Onix1.Design/NeuropixelsV1Dialog.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 89 additions & 0 deletions OpenEphys.Onix1.Design/NeuropixelsV1Dialog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using System;
using System.Windows.Forms;

namespace OpenEphys.Onix1.Design
{
/// <summary>
/// Partial class to create a GUI for <see cref="ConfigureNeuropixelsV1e"/>.
/// </summary>
public partial class NeuropixelsV1Dialog : Form
{
readonly NeuropixelsV1ProbeConfigurationDialog ProbeConfigurationDialog;

/// <summary>
/// Public <see cref="IConfigureNeuropixelsV1"/> interface that is manipulated by
/// <see cref="NeuropixelsV1Dialog"/>.
/// </summary>
public IConfigureNeuropixelsV1 ConfigureNode { get; set; }

/// <summary>
/// Initializes a new instance of <see cref="NeuropixelsV1Dialog"/>.
/// </summary>
/// <param name="configureNode">A <see cref="ConfigureNeuropixelsV1e"/> object holding the current configuration settings.</param>
public NeuropixelsV1Dialog(IConfigureNeuropixelsV1 configureNode)
{
InitializeComponent();
Shown += FormShown;

if (configureNode is ConfigureNeuropixelsV1e configureV1e)
{
ConfigureNode = new ConfigureNeuropixelsV1e(configureV1e);
}
else if (configureNode is ConfigureNeuropixelsV1f configureV1f)
{
ConfigureNode = new ConfigureNeuropixelsV1f(configureV1f);
Text += ": " + GetProbeName(configureV1f.ProbeName);
}

ProbeConfigurationDialog = new(ConfigureNode.ProbeConfiguration, ConfigureNode.AdcCalibrationFile, ConfigureNode.GainCalibrationFile)
{
TopLevel = false,
FormBorderStyle = FormBorderStyle.None,
Dock = DockStyle.Fill,
Parent = this
};

panelProbe.Controls.Add(ProbeConfigurationDialog);

this.AddMenuItemsFromDialogToFileOption(ProbeConfigurationDialog);
}

private string GetProbeName(NeuropixelsV1Probe probe)
{
return probe switch
{
NeuropixelsV1Probe.ProbeA => "Probe A",
NeuropixelsV1Probe.ProbeB => "Probe B",
_ => "Invalid probe was specified."
};
}

private void FormShown(object sender, EventArgs e)
{
if (!TopLevel)
{
tableLayoutPanel1.Controls.Remove(flowLayoutPanel1);
tableLayoutPanel1.RowCount = 1;

menuStrip.Visible = false;
}

ProbeConfigurationDialog.Show();
}

internal void Okay_Click(object sender, EventArgs e)
{
SaveVariables();

DialogResult = DialogResult.OK;
}

internal void SaveVariables()
{
ConfigureNode.ProbeConfiguration = ProbeConfigurationDialog.ProbeConfiguration;

ConfigureNode.GainCalibrationFile = ProbeConfigurationDialog.textBoxGainCalibrationFile.Text;
ConfigureNode.AdcCalibrationFile = ProbeConfigurationDialog.textBoxAdcCalibrationFile.Text;
}
}
}
Loading

0 comments on commit cea6b89

Please sign in to comment.