Chronos Plugins 5.9.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
387 IEnumerable<ITaskInfo> JobsTasks { get; }
391 Guid PlanerID { get; }
392
399 int JobNo { get; }
400
401
405 IEnumerable<IInspectJob> Previous { get; }
409 IEnumerable<IInspectJob> Next { get; }
410
415
422 IEnumerable<ITaskInfo> CompleteSchedule { get; }
423 }
424
428 public interface IMethodInfo
429 {
434 string Filename { get; }
438 string Name { get; }
442 string Description { get; }
446 IReadOnlyList<IColumnInfo> Columns { get; }
447 }
448
455 [Guid("E4851471-E72B-4302-A29C-0CFE7E42259A")]
456 public interface IResourceManager
457 {
464 bool AreAllPositionsFree(string trayName, IDevice sampler);
465 }
466
470 [Guid("10C465A4-3993-4ECD-B983-8AC73B0E0AA6")]
471 public interface IUseResources : ITask
472 {
477 }
478
482 [Guid("C50A0177-21DF-407D-AEA4-B806B8F0BF3E")]
484 {
489 }
490
501 [Guid("93EEA6AD-FDC6-4976-8D28-220A98CF3097")]
503 {
508 }
517 public delegate bool JITCheckerDelegate(object task, string propertyPath);
518
525 [Guid("9E8721BC-8DF4-46D1-BF26-DA7693685072")]
526 public interface IGiveARuntimeHint : ITask
527 {
535 int? CalculatedRuntime { get; }
536 }
537
548 [Guid("18D63C7A-A8AA-4FEA-9D64-59AEF95103EC")]
549 public interface IWantEditorUpdates
550 {
556 void PropertyEdited(string propName, object propValue);
557 }
558
565 [AttributeUsage(AttributeTargets.Property)]
566 public class InvisibleByDefaultAttribute : Attribute
567 {
568 }
569
573 [AttributeUsage(AttributeTargets.Class)]
574 public class ScheduleDiagramColorAttribute : Attribute
575 {
579 public Color Color { get; }
584 public ScheduleDiagramColorAttribute(string myColor)
585 {
586 var pd = typeof(Colors).GetProperty(myColor);
587 Color = (pd?.GetValue(null) as Color?).GetValueOrDefault();
588 }
589
597 public ScheduleDiagramColorAttribute(byte A, byte R, byte G, byte B)
598 {
599 Color = Color.FromArgb(A, R, G, B);
600 }
601 }
602
606 [AttributeUsage(AttributeTargets.Class)]
607 public class TaskCategoryAttribute : Attribute
608 {
614 public TaskCategoryAttribute(TaskCategory category, int ranking=0)
615 {
616 Category = category;
617 RankWithinCategory = ranking;
618 }
619
626 // ReSharper disable once AutoPropertyCanBeMadeGetOnly.Local
627 public TaskCategory Category { get; private set; }
634 // ReSharper disable once AutoPropertyCanBeMadeGetOnly.Global
635 public int RankWithinCategory { get; set; }
636 }
637
641 [AttributeUsage(AttributeTargets.Class)]
643 {
648 protected CustomTaskCategoryAttribute(int ranking = 0) : base(TaskCategory.Misc, ranking)
649 {
650 }
655 public abstract string Name { get; }
656 }
657
658
662 public enum TaskCategory
663 {
667 SamplePrep = 1,
671 Cleaning = 2,
675 Injection = 3,
679 IO = 4,
683 CDS = 5,
687 FlowControl = 6,
691 SPME = 7,
695 Misc = 8,
699 PAL3SDK = 9,
703 LCMS = 10,
707 ITSP = 11,
711 ITEX = 12
712 }
713
714
718 [AttributeUsage(AttributeTargets.Property)]
719 public class LinkPropertyAttribute : Attribute
720 {
725 public LinkPropertyAttribute(string taskPropertyPath)
726 {
727 var sp=taskPropertyPath.Split('.');
728 TaskName = sp[0];
729
730 if (sp.Length>1) PropertyName = sp[1];
731 }
732
738 public LinkPropertyAttribute(string taskName, string propertyName)
739 {
740 TaskName = taskName;
741 PropertyName = propertyName;
742 }
749 public string TaskName { get; }
750
757 public string PropertyName { get; }
758 }
759
763 public abstract class StandardValueProviderAttribute : Attribute
764 {
770 public abstract IEnumerable GetStandardValues(ITask theTask);
771 }
772
773
779 [AttributeUsage(AttributeTargets.Property)]
781 {
783
787 public enum TargetMode
788 {
792 FileRead,
796 FileWrite,
800 Folder
801 }
802
807 {
808 get => mMode;
809 set
810 {
811 mMode = value;
812 switch (value)
813 {
814 case TargetMode.FileRead:
815 case TargetMode.FileWrite:
817 break;
818 case TargetMode.Folder:
820 break;
821 }
822 }
823 }
824
828 public virtual string GetCaption() => string.Empty;
829
833 public virtual string GetFilenamePattern() => string.Empty;
834
840 public virtual string GetInitialValue(ITask theTask) => string.Empty;
841
846 {
847 }
848 }
849
854 {
858 public string Caption { get; set; }
862 public string FilenamePattern { get; set; }
866 public string InitialValue { get; set; }
867
872 public override string GetCaption() => Caption;
877 public override string GetFilenamePattern() => FilenamePattern;
878
884 public override string GetInitialValue(ITask theTask) => InitialValue;
885 }
886
887
888
889}
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.
@ 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".
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,...
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.