Chronos Plugins 5.9.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
UseTrain.cs
Go to the documentation of this file.
1using System;
4// ReSharper disable MemberCanBePrivate.Global
5// ReSharper disable UnusedMember.Global
6
7namespace MockPlugin.Tasks
8{
9
13 public class UseTrain : ITaskForDevice
14 {
16
17 public void PreValidate()
18 {
19
20 }
21
22 public void PostValidate()
23 {
24 if (mMyTrainPart == null)
25 {
26 throw new InvalidOperationException("Need a train part as \"Autosampler\"");
27 }
28 }
29
30 public bool DoorsOpen { get; set; }
31
32 public void Execute()
33 {
34 mMyTrainPart.DoorsOpen = DoorsOpen;
35 }
36
37 public string GetTaskAction()
38 {
39 return $"{(DoorsOpen ? "Opening" : "Closing")} the doors of {mMyTrainPart?.Name ?? "N/A"}";
40 }
41
42 [DevicesLimited(typeof(TrainPart))]
43 public void SetDevice(IDevice yourDevice)
44 {
45 mMyTrainPart = yourDevice as TrainPart;
46 }
47 }
48}
Classes and interfaces that are meant for plugins. The classes and interfaces below this namespace ar...
A fake device. This namespace contains the fake device driver and auxiliary classes for settings,...
Example task implementations. Since there are lots of things that can be done from a task,...
To be implemented by the "device driver" part of a Chronos plugin.
To be implemented if the task needs to access a device ("Autosampler" property in Chronos)
The device part (well, train part) can't do much, just send status messages when the doors are opened...
Definition Train.cs:77
Just show that some kind of operation can be done with our "Train" device parts.
Definition UseTrain.cs:14
void PreValidate()
Called before the schedule construction is completed.
Definition UseTrain.cs:17
void PostValidate()
Called after the schedule construction is completed.
Definition UseTrain.cs:22
void SetDevice(IDevice yourDevice)
Will be called by chronos when building the schedule.
Definition UseTrain.cs:43
string GetTaskAction()
Description of the tasks's action (for hints/time table)
Definition UseTrain.cs:37
void Execute()
Do whatever you have to do with your parameters.
Definition UseTrain.cs:32