Chronos Plugins 5.4.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
TaskInterfaces.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using System.Runtime.InteropServices;
3using System;
4using System.Collections;
5using System.Linq;
6using System.Windows.Forms.VisualStyles;
7using System.Windows.Media;
9
10// ReSharper disable InconsistentNaming
11
13{
22 [Guid("762DF08B-F3F5-40E1-A652-B7789184FBD5")]
23 public interface ITask
24 {
29
34
38 void Execute();
39
43 string GetTaskAction();
44 }
45
53 public interface IPluginTaskAdapter : ITask, IPluginAdapter<ITask>
54 {
55
56 }
57
61 [Guid("3C667034-390B-4D9F-B388-EB85260945C9")]
62 public interface IDemoAwareTask : ITask
63 {
68 }
69
70 // ReSharper disable CommentTypo
161 public class DefaultUnitAttribute : Attribute
162 {
166 public string UnitSymbol { get; }
167
172 public DefaultUnitAttribute(string unitSymbol)
173 {
174 UnitSymbol = unitSymbol;
175 }
176 }
177
186 [AttributeUsage(AttributeTargets.Class)]
187 public class SuppressPathPrefixAttribute : Attribute
188 {
189 }
190
194 [Guid("BE90190E-7BC8-48DD-81E1-0DDA5E0D7AF1")]
195 public interface IAbortableTask : ITask
196 {
204 // ReSharper disable once UnusedMemberInSuper.Global
205 bool Aborted { get; set; }
206 }
207
211 [Guid("DC894545-E16E-4831-A3F6-E2A2E19D4CFD")]
212 public interface ITaskForDevice : ITask
213 {
218 void SetDevice(IDevice yourDevice);
219 }
220
225 [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)]
226 // ReSharper disable once ClassWithVirtualMembersNeverInherited.Global
227 public class DevicesLimitedAttribute : Attribute
228 {
232 private readonly Type[] mLimitedTo;
233
238 public DevicesLimitedAttribute(params Type[] types)
239 {
240 mLimitedTo = types;
241 }
242
243
249 public virtual bool IsOK(Type someDeviceType)
250 {
251 return mLimitedTo?.Any(someType => someType.IsAssignableFrom(someDeviceType)) ?? false;
252 }
253 }
254
265 [Guid("A1167144-70F6-456F-ACE5-247BB884823F")]
266 public interface IAccessProperty
267 {
271 object BaseObject { get; }
272
276 System.Reflection.PropertyInfo PropInfo { get; }
280 string FullPath { get; }
281 }
282
289 [Guid("F2F56703-E5F7-4652-B093-0134D4514D16")]
290 public interface ITaskInfo
291 {
298 int JobNo { get; }
299
306 int TaskIndex { get; }
307
311 object Task { get; }
312
316 IEnumerable<IAccessProperty> PropertyAccessInfos { get; }
331 int UserVisibleIndex { get; }
335 int? RepeatCounter { get; }
336 #region Easy access common properties
345 bool Enabled { get; set; }
353 int StartTime { get; }
360 int Runtime { get; }
361 #endregion
362 }
363
368 [Guid("F1D539E5-9612-48C3-852E-F655FA909520")]
369 public interface IInspectJob
370 {
371
379
383 IEnumerable<ITaskInfo> JobsTasks { get; }
387 Guid PlanerID { get; }
388
395 int JobNo { get; }
396
397
401 IEnumerable<IInspectJob> Previous { get; }
405 IEnumerable<IInspectJob> Next { get; }
406
411
415 IEnumerable<ITaskInfo> CompleteSchedule { get; }
416 }
417
421 public interface IMethodInfo
422 {
427 string Filename { get; }
431 string Name { get; }
435 string Description { get; }
439 IReadOnlyList<IColumnInfo> Columns { get; }
440 }
441
448 [Guid("E4851471-E72B-4302-A29C-0CFE7E42259A")]
449 public interface IResourceManager
450 {
457 bool AreAllPositionsFree(string trayName, IDevice sampler);
458 }
459
463 [Guid("10C465A4-3993-4ECD-B983-8AC73B0E0AA6")]
464 public interface IUseResources : ITask
465 {
470 }
471
475 [Guid("C50A0177-21DF-407D-AEA4-B806B8F0BF3E")]
477 {
482 }
483
494 [Guid("93EEA6AD-FDC6-4976-8D28-220A98CF3097")]
496 {
501 }
510 public delegate bool JITCheckerDelegate(object task, string propertyPath);
511
518 [Guid("9E8721BC-8DF4-46D1-BF26-DA7693685072")]
519 public interface IGiveARuntimeHint : ITask
520 {
528 int? CalculatedRuntime { get; }
529 }
530
541 [Guid("18D63C7A-A8AA-4FEA-9D64-59AEF95103EC")]
542 public interface IWantEditorUpdates
543 {
549 void PropertyEdited(string propName, object propValue);
550 }
551
558 [AttributeUsage(AttributeTargets.Property)]
559 public class InvisibleByDefaultAttribute : Attribute
560 {
561 }
562
566 [AttributeUsage(AttributeTargets.Class)]
567 public class ScheduleDiagramColorAttribute : Attribute
568 {
572 public Color Color { get; }
577 public ScheduleDiagramColorAttribute(string myColor)
578 {
579 var pd = typeof(Colors).GetProperty(myColor);
580 Color = (pd?.GetValue(null) as Color?).GetValueOrDefault();
581 }
582
590 public ScheduleDiagramColorAttribute(byte A, byte R, byte G, byte B)
591 {
592 Color = Color.FromArgb(A, R, G, B);
593 }
594 }
595
599 [AttributeUsage(AttributeTargets.Class)]
600 public class TaskCategoryAttribute : Attribute
601 {
607 public TaskCategoryAttribute(TaskCategory category, int ranking=0)
608 {
609 Category = category;
610 RankWithinCategory = ranking;
611 }
612
619 // ReSharper disable once AutoPropertyCanBeMadeGetOnly.Local
620 public TaskCategory Category { get; private set; }
627 // ReSharper disable once AutoPropertyCanBeMadeGetOnly.Global
628 public int RankWithinCategory { get; set; }
629 }
630
634 [AttributeUsage(AttributeTargets.Class)]
636 {
641 protected CustomTaskCategoryAttribute(int ranking = 0) : base(TaskCategory.Misc, ranking)
642 {
643 }
648 public abstract string Name { get; }
649 }
650
651
655 public enum TaskCategory
656 {
660 SamplePrep = 1,
664 Cleaning = 2,
668 Injection = 3,
672 IO = 4,
676 CDS = 5,
680 FlowControl = 6,
684 SPME = 7,
688 Misc = 8,
692 PAL3SDK = 9,
696 LCMS = 10,
700 ITSP = 11,
704 ITEX = 12
705 }
706
707
711 [AttributeUsage(AttributeTargets.Property)]
712 public class LinkPropertyAttribute : Attribute
713 {
718 public LinkPropertyAttribute(string taskPropertyPath)
719 {
720 var sp=taskPropertyPath.Split('.');
721 TaskName = sp[0];
722
723 if (sp.Length>1) PropertyName = sp[1];
724 }
725
731 public LinkPropertyAttribute(string taskName, string propertyName)
732 {
733 TaskName = taskName;
734 PropertyName = propertyName;
735 }
742 public string TaskName { get; }
743
750 public string PropertyName { get; }
751 }
752
756 public abstract class StandardValueProviderAttribute : Attribute
757 {
763 public abstract IEnumerable GetStandardValues(ITask theTask);
764 }
765
766
772 [AttributeUsage(AttributeTargets.Property)]
774 {
776
780 public enum TargetMode
781 {
785 FileRead,
789 FileWrite,
793 Folder
794 }
795
800 {
801 get => mMode;
802 set
803 {
804 mMode = value;
805 switch (value)
806 {
807 case TargetMode.FileRead:
808 case TargetMode.FileWrite:
810 break;
811 case TargetMode.Folder:
813 break;
814 }
815 }
816 }
817
821 public virtual string GetCaption() => string.Empty;
822
826 public virtual string GetFilenamePattern() => string.Empty;
827
833 public virtual string GetInitialValue(ITask theTask) => string.Empty;
834
839 {
840 }
841 }
842
847 {
851 public string Caption { get; set; }
855 public string FilenamePattern { get; set; }
859 public string InitialValue { get; set; }
860
865 public override string GetCaption() => Caption;
870 public override string GetFilenamePattern() => FilenamePattern;
871
877 public override string GetInitialValue(ITask theTask) => InitialValue;
878 }
879
880
881
882}
Classes and interfaces that are meant for plugins. The classes and interfaces below this namespace ar...
TaskCategory
The enumeration of Task Categories.
@ Cleaning
The cleaning Category.
@ FlowControl
The flow control Category.
@ Injection
The injection Category.
@ Misc
The miscellaneous Category.
@ PAL3SDK
The PAL3 SDK Category.
@ IO
The Input Output Category.
@ SamplePrep
The sample prep Category.
delegate bool JITCheckerDelegate(object task, string propertyPath)
The delegate that does the check for you.
Interfaces for custom sample list column type definitions. These interfaces allow you to define new c...
Definition: ColumnMenu.cs:4
BuiltinColumnTypeName
Convenience enumeration to avoid spelling errors.
Definition: ColumnType.cs:50
Decorate a task property with this attribute to recommend a specific column type for the "convert to ...
Definition: ColumnType.cs:73
string InternalColumnTypeName
Name of the column type as used internally in the method XML.
Definition: ColumnType.cs:93
To be implemented by the "device driver" part of a Chronos plugin.
Generic way to access a plugin object that was wrapped by Chronos.
To be implemented by the "task" part of a Chronos plugin. Public properties of the implementing type ...
void Execute()
Do whatever you have to do with your parameters.
void PostValidate()
Called after the schedule construction is completed.
string GetTaskAction()
Description of the tasks's action (for hints/time table)
void PreValidate()
Called before the schedule construction is completed.
Do not implement this interface.
For tasks that try to do some special actions during schedule demo execution.
void DemoExecute()
Will be called when the task is executed in demo mode.
Use this on your task property if you want the method editor to show a default unit.
string UnitSymbol
Unit symbol, like "m" or "mL/s".
DefaultUnitAttribute(string unitSymbol)
Standard constructor for specifying the unit used by the property.
Please don't use this unless you are sure you know what you are doing! Set this attribute on your tas...
Implement this interface if your task does some long lasting operation which should be interruptible.
bool Aborted
Will be set if your task's "Execute" method should exit as soon as possible. Will be reset before ret...
To be implemented if the task needs to access a device ("Autosampler" property in Chronos)
void SetDevice(IDevice yourDevice)
Will be called by chronos when building the schedule.
Add this attribute to your ITaskForDevice.SetDevice method or your IDevice property if you are using ...
DevicesLimitedAttribute(params Type[] types)
Takes a whitelist of sampler types that are OK for your task.
virtual bool IsOK(Type someDeviceType)
Override this if you need a more complex logic than simple type whitelisting.
readonly Type[] mLimitedTo
For the default implementation.
Gives full access to other tasks's properties.
object BaseObject
Reference to the object to which the property belongs.
string FullPath
Full path, as must be given in property reference expressions.
System.Reflection.PropertyInfo PropInfo
All you need to know about the property.
Gives access to a task's implementation and to all user visible properties.
int TaskIndex
Gets the index of the task.
int? RepeatCounter
If this is within a repeat loop, the respective iteration number, else null.
bool Enabled
Should this task be executed?
int StartTime
Time relative to schedule start in seconds when this task was started / will be started.
IEnumerable< IAccessProperty > PropertyAccessInfos
Enumeration of all visible properties of this task.
IDevice Autosampler
Get the Plugin-friendly wrapper for the task's autosampler, if available, else null.
int UserVisibleIndex
The index as seen in the method editor.
int Runtime
Task duration in seconds.
object Task
Task object, Chronos internal type.
ITask PluginTask
Gets the unwrapped ITask implementation if this is a plugin task, else null.
Allows to get information about other tasks within our task's job and about other jobs.
IEnumerable< IInspectJob > Previous
Lets you iterate over jobs further up the sample list, in reverse order.
IMethodInfo MethodInfo
Info about the method this job was created from.
IEnumerable< ITaskInfo > CompleteSchedule
All tasks involved in the current schedule.
IEnumerable< IInspectJob > Next
Lets you iterate over jobs further down the sample list.
int JobNo
Gets the zero based job index.
IEnumerable< ITaskInfo > JobsTasks
Enumerate the tasks in your task's job.
Guid PlanerID
For use with the schedule state awareness interfaces.
ITaskInfo CurrentTask
Gets the current Jobs current Task.
Information about the method that was used to create this job.
string Filename
Path to the method file, including the filename.
string Name
Name as entered in the method editor.
string Description
Description as entered in the method editor.
IReadOnlyList< IColumnInfo > Columns
Column definition information.
The resource manager is your interface to the scheduler regarding occupied or locked objects.
bool AreAllPositionsFree(string trayName, IDevice sampler)
Check if the positions of a tray are considered free by the scheduler.
Implement this interface if you need to communicate with the scheduler about locked/occupied objects.
IResourceManager ResourceManager
The resource manager object is assigned to this property.
Implement this interface if you have to access other tasks within the schedule.
IInspectJob JobInspector
The JobInspector lets you see information about other tasks and their properties.
Implement this interface if you have to know (usually for validation) if a certain property of a give...
JITCheckerDelegate JITChecker
Chronos will provide a function that you can use to check for JIT expressions in properties.
If you can calculate your runtime, you should implement this interface.
int? CalculatedRuntime
Get an idea of the expected runtime.
Implement this interface in your task if you want the method editor to notify it of changed propertie...
void PropertyEdited(string propName, object propValue)
This will be called as soon as a property was changed in the method editor.
Use this attribute to mark a property as only visible to users who explicitly look for invisible prop...
Override the default color that is used to display the task in the schedule diagram.
ScheduleDiagramColorAttribute(byte A, byte R, byte G, byte B)
Alternate way to provide the color.
ScheduleDiagramColorAttribute(string myColor)
Set the desired color here.
The Task Category Method Attribute.
TaskCategoryAttribute(TaskCategory category, int ranking=0)
Initializes a new instance of the TaskCategoryAttribute class.
int RankWithinCategory
Gets or sets the rank within category.
Use this if none of the predefined categories fit and you have a better idea than "Misc".
abstract string Name
Calls your custom function returning the display name.
Attribute to link the decorated Property with the specifyed Task and TaskProperty.
string TaskName
The name of the task to be linked with.
string PropertyName
The property name to be linked with.
LinkPropertyAttribute(string taskName, string propertyName)
Initializes a new instance of the LinkPropertyAttribute class.
LinkPropertyAttribute(string taskPropertyPath)
Initializes a new instance of the LinkPropertyAttribute class.
If your standard value list cannot be provided without knowing the actual task's details,...
abstract IEnumerable GetStandardValues(ITask theTask)
Return the standard value list depending on the given task instance.
State that the task property describes a filename/folder name and should offer a picker dialog in the...
virtual string GetCaption()
Title of the dialog.
FilenameAttribute()
Default constructor: Ask for a file that should be read.
virtual string GetFilenamePattern()
File type specification as described on MSDN: https://docs.microsoft.com/en-us/dotnet/api/microsoft....
TargetMode
Dialog type: Open file for reading or for writing? Folder?
@ FileWrite
File should be opened for writing.
@ FileRead
File should be opened for reading.
virtual string GetInitialValue(ITask theTask)
Override this if the initial value needs to depend on other properties of the task.
TargetMode Mode
File mode for this property.
Easier to use if you don't care about localization.
string FilenamePattern
File type specification as described on MSDN: https://docs.microsoft.com/en-us/dotnet/api/microsoft....
override string GetInitialValue(ITask theTask)
Just returning the value of the property here.
string InitialValue
First value to show to the user.
override string GetCaption()
Just returning the property's value.
override string GetFilenamePattern()
Just returning the property's value.