This framework is specifically made for apps controlling physical experiments.
Its purpose is to manage external components and provide a layer of abstraction which makes switching between different implementations (devices surving a specific purpose, for example different lasers) easy.
Implementations exist for Lasers (TOPTICA), Cameras (Andor, Baumer, FLIR Grasshopper, Photonfocus) and Stages (MadCityLabs, SmarAct), although the source code can't be put under Open Source.
For a working example (including the UI components), see the TestApp.
var Components = ExperimentContainer.Singleton;Add component classes:
Components.AddComponentClass<LaserComponent>();
Components.AddComponentClass<StageComponent>();Add all available implementations:
Components.AddComponent<FakeLaser>();
Components.AddComponent<OtherLaser>();
Components.AddComponent<LaserOfChoice>();
Components.AddComponent<FakeStage>();Make the component settings persistent:
Components.UseWinUISettingsStore();
Components.LoadFromSettings();Initialize a component (if not anyway being done by LoadFromSettings or by the ExperimentSettings component):
Components.ActivateComponentAsync(typeof(LaserComponent), null, typeof(FakeLaser).Name, new FakeLaserSettings());Get & use a component:
var laser = Components.GetActiveComponent<LaserComponent>();
laser.IsOn = true;Get notified on component changes:
// either (for a specific component):
Components.AddComponentChangeHandler<LaserComponent>((newLaser) => { ... });
// or (for all component changes):
Components.ComponentChanged += (componentClass, id, newComponent) => { ... };The framework comes with a few WinUI components:
Displays controls to change between different component class implementations and change their respective settings:
Shows a statusbar which displays all loaded components and their state (double click to reload a component):
