Skip to content

Commit 07e0753

Browse files
committed
Restrict possible driver values
1 parent 67f250d commit 07e0753

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System.ComponentModel;
2+
3+
namespace OpenEphys.Onix1
4+
{
5+
internal class ContextDriverConverter : StringConverter
6+
{
7+
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
8+
{
9+
return true;
10+
}
11+
12+
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
13+
{
14+
return true;
15+
}
16+
17+
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
18+
{
19+
return new StandardValuesCollection(new[]
20+
{
21+
"riffa"
22+
});
23+
}
24+
}
25+
}

OpenEphys.Onix1/CreateContext.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class CreateContext
1919
/// </summary>
2020
[Description("Specifies the device driver used to communicate with hardware.")]
2121
[Category(DeviceFactory.ConfigurationCategory)]
22+
[TypeConverter(typeof(ContextDriverConverter))]
2223
public string Driver { get; set; } = ContextTask.DefaultDriver;
2324

2425
/// <summary>

0 commit comments

Comments
 (0)