-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathPolledBno055Dialog.cs
75 lines (64 loc) · 2.5 KB
/
PolledBno055Dialog.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System;
using System.ComponentModel;
namespace OpenEphys.Onix1.Design
{
/// <summary>
/// Partial class to create a GUI for <see cref="ConfigurePolledBno055"/>.
/// </summary>
public partial class PolledBno055Dialog : GenericDeviceDialog
{
/// <summary>
/// Gets or sets the <see cref="ConfigurePolledBno055"/> object attached to
/// the property grid.
/// </summary>
internal InternalPolledBno055 Bno055 { get; set; }
/// <summary>
/// Initializes a new <see cref="PolledBno055Dialog"/> instance with the given
/// <see cref="ConfigurePolledBno055"/> object.
/// </summary>
/// <param name="configureNode">A <see cref="ConfigurePolledBno055"/> object that contains configuration settings.</param>
/// <param name="allFieldsEditable">
/// Boolean that is true if this <see cref="ConfigurePolledBno055"/> should be allowed to
/// edit the <see cref="ConfigurePolledBno055.AxisMap"/> and <see cref="ConfigurePolledBno055.AxisSign"/>
/// properties. It is set to false when called from headstage editors.</param>
public PolledBno055Dialog(ConfigurePolledBno055 configureNode, bool allFieldsEditable = false)
{
InitializeComponent();
Shown += FormShown;
Bno055 = new(configureNode);
if (allFieldsEditable)
{
propertyGrid.SelectedObject = Bno055.Bno055;
}
else
{
propertyGrid.SelectedObject = Bno055;
}
}
private void FormShown(object sender, EventArgs e)
{
if (!TopLevel)
{
tableLayoutPanel1.Controls.Remove(flowLayoutPanel1);
tableLayoutPanel1.RowCount = 1;
MaximumSize = new System.Drawing.Size(0, 0);
}
}
}
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; }
}
}