-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRegistry.cs
34 lines (29 loc) · 1017 Bytes
/
Registry.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
using System;
using System.Collections.Generic;
using Fluid;
namespace TecanSparkRelay.Protocols
{
public class Registry
{
private readonly static Dictionary<string, Type> protocols = new Dictionary<string, Type>
{
["MeasureAbsorbance"] = typeof(MeasureAbsorbance),
};
static Registry()
{
TemplateContext.GlobalMemberAccessStrategy.Register<Plate>();
TemplateContext.GlobalMemberAccessStrategy.Register<Well>();
foreach (var protocolName in protocols.Keys)
{
// Register each protocol
var protocol = GetProtocol(protocolName);
protocol.Register(protocolName);
TemplateContext.GlobalMemberAccessStrategy.Register(protocol.SpecType());
}
}
public static Protocol GetProtocol(string protocol)
{
return (Protocol)Activator.CreateInstance(protocols[protocol], new object[] { });
}
}
}