Chronos Plugins 5.4.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
MockPlugin.Tasks.JobInspectionDemo Class Reference

Shows how to get information about other tasks in the schedule. More...

+ Inheritance diagram for MockPlugin.Tasks.JobInspectionDemo:
+ Collaboration diagram for MockPlugin.Tasks.JobInspectionDemo:

Properties

IInspectJob INeedToInspectOtherTasks. JobInspector [set]
 The JobInspector lets you see information about other tasks and their properties.
 
JITCheckerDelegate JITChecker [set]
 Chronos will provide a function that you can use to check for JIT expressions in properties.
 
- Properties inherited from AxelSemrau.Chronos.Plugin.INeedToInspectOtherTasks
IInspectJob JobInspector [set]
 The JobInspector lets you see information about other tasks and their properties.
 
- Properties inherited from AxelSemrau.Chronos.Plugin.INeedToCheckForJITLinks
JITCheckerDelegate JITChecker [set]
 Chronos will provide a function that you can use to check for JIT expressions in properties.
 

Private Member Functions

void ITask. PreValidate ()
 Called before the schedule construction is completed.
 
void DisablePreviousTwin ()
 Shows how you can disable other tasks in the schedule creation phase. If there's a previous JobInspectionDemo task, let's turn it off.
 
void ITask. PostValidate ()
 Called after the schedule construction is completed.
 
string GetJitInfo (ITaskInfo someTaskInfo, IAccessProperty somePropInfo)
 
void ITask. Execute ()
 Do whatever you have to do with your parameters.
 
string ITask. GetTaskAction ()
 Description of the tasks's action (for hints/time table)
 

Private Attributes

IInspectJob mJobInspector
 
JITCheckerDelegate mJitChecker
 

Additional Inherited Members

void PreValidate ()
 Called before the schedule construction is completed.
 
void PostValidate ()
 Called after the schedule construction is completed.
 
void Execute ()
 Do whatever you have to do with your parameters.
 
string GetTaskAction ()
 Description of the tasks's action (for hints/time table)
 

Detailed Description

Shows how to get information about other tasks in the schedule.

Definition at line 12 of file MockJobInspectingTask.cs.

Member Function Documentation

◆ DisablePreviousTwin()

void MockPlugin.Tasks.JobInspectionDemo.DisablePreviousTwin ( )
private

Shows how you can disable other tasks in the schedule creation phase. If there's a previous JobInspectionDemo task, let's turn it off.

Exceptions
System.NotImplementedException

Definition at line 30 of file MockJobInspectingTask.cs.

31 {
32 var prevTask = mJobInspector.CompleteSchedule
33 .TakeWhile(someTaskInfo => someTaskInfo.PluginTask != mJobInspector.CurrentTask.PluginTask).LastOrDefault();
34 if (prevTask?.PluginTask is JobInspectionDemo)
35 {
36 prevTask.Enabled = false;
37 }
38 }
ITask PluginTask
Gets the unwrapped ITask implementation if this is a plugin task, else null.
ITaskInfo CurrentTask
Gets the current Jobs current Task.

References AxelSemrau.Chronos.Plugin.IInspectJob.CurrentTask, MockPlugin.Tasks.JobInspectionDemo.mJobInspector, and AxelSemrau.Chronos.Plugin.ITaskInfo.PluginTask.

Referenced by MockPlugin.Tasks.JobInspectionDemo.PostValidate().

◆ Execute()

void ITask. MockPlugin.Tasks.JobInspectionDemo.Execute ( )
private

Do whatever you have to do with your parameters.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 53 of file MockJobInspectingTask.cs.

54 {
55 var sb = new StringBuilder();
56 var i = 1;
57 foreach (var someTaskInfo in mJobInspector.JobsTasks)
58 {
59 sb.AppendLine($"Task {i++}");
60 sb.AppendFormat("Class {0}, {1} properties\r\n",
61 someTaskInfo.Task.GetType().Name,
62 someTaskInfo.PropertyAccessInfos.Count());
63 foreach (var somePropInfo in someTaskInfo.PropertyAccessInfos)
64 {
65 sb.AppendFormat("Property {0}: {1}, jit? {2}\r\n",
66 somePropInfo.PropInfo.Name,
67 somePropInfo.PropInfo.GetValue(somePropInfo.BaseObject, null),
68 GetJitInfo(someTaskInfo,somePropInfo));
69 }
70 sb.AppendLine();
71 }
72 System.Windows.Forms.MessageBox.Show(Helpers.Gui.MainWindow, sb.ToString(), "Checked other tasks");
73 }
IWin32Window MainWindow
If you need to set the owner window yourself or want to show message boxes.
Definition: Helpers.cs:37
Static instance for access to utility functions and resources.
Definition: Helpers.cs:78
static IGuiHelper Gui
Utility functions for window handling.
Definition: Helpers.cs:92
IEnumerable< ITaskInfo > JobsTasks
Enumerate the tasks in your task's job.
string GetJitInfo(ITaskInfo someTaskInfo, IAccessProperty somePropInfo)

References MockPlugin.Tasks.JobInspectionDemo.GetJitInfo(), AxelSemrau.Chronos.Plugin.Helpers.Gui, AxelSemrau.Chronos.Plugin.IInspectJob.JobsTasks, AxelSemrau.Chronos.Plugin.IGuiHelper.MainWindow, and MockPlugin.Tasks.JobInspectionDemo.mJobInspector.

◆ GetJitInfo()

string MockPlugin.Tasks.JobInspectionDemo.GetJitInfo ( ITaskInfo  someTaskInfo,
IAccessProperty  somePropInfo 
)
private

Definition at line 45 of file MockJobInspectingTask.cs.

46 {
47 if(mJitChecker == null)
48 {
49 return "N/A";
50 }
51 return mJitChecker(someTaskInfo.Task,somePropInfo.FullPath) ? "yes" : "no";
52 }
string FullPath
Full path, as must be given in property reference expressions.
object Task
Task object, Chronos internal type.

References AxelSemrau.Chronos.Plugin.IAccessProperty.FullPath, MockPlugin.Tasks.JobInspectionDemo.mJitChecker, and AxelSemrau.Chronos.Plugin.ITaskInfo.Task.

Referenced by MockPlugin.Tasks.JobInspectionDemo.Execute().

◆ GetTaskAction()

string ITask. MockPlugin.Tasks.JobInspectionDemo.GetTaskAction ( )
private

Description of the tasks's action (for hints/time table)

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 75 of file MockJobInspectingTask.cs.

76 {
77 return "Snooping around";
78 }

◆ PostValidate()

void ITask. MockPlugin.Tasks.JobInspectionDemo.PostValidate ( )
private

Called after the schedule construction is completed.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 40 of file MockJobInspectingTask.cs.

41 {
43 }
void DisablePreviousTwin()
Shows how you can disable other tasks in the schedule creation phase. If there's a previous JobInspec...

References MockPlugin.Tasks.JobInspectionDemo.DisablePreviousTwin().

◆ PreValidate()

void ITask. MockPlugin.Tasks.JobInspectionDemo.PreValidate ( )
private

Called before the schedule construction is completed.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 16 of file MockJobInspectingTask.cs.

17 {
18 if (mJitChecker != null)
19 {
20 System.Windows.Forms.MessageBox.Show(Helpers.Gui.MainWindow,
21 $"My enabled property {(mJitChecker(this, "Enabled") ? "will be set by a JIT expression" : "has an ordinary value")}", "JobInspectionDemo");
22 }
23 }

References AxelSemrau.Chronos.Plugin.Helpers.Gui, AxelSemrau.Chronos.Plugin.IGuiHelper.MainWindow, and MockPlugin.Tasks.JobInspectionDemo.mJitChecker.

Member Data Documentation

◆ mJitChecker

JITCheckerDelegate MockPlugin.Tasks.JobInspectionDemo.mJitChecker
private

◆ mJobInspector

IInspectJob MockPlugin.Tasks.JobInspectionDemo.mJobInspector
private

Property Documentation

◆ JITChecker

JITCheckerDelegate MockPlugin.Tasks.JobInspectionDemo.JITChecker
set

Chronos will provide a function that you can use to check for JIT expressions in properties.

Implements AxelSemrau.Chronos.Plugin.INeedToCheckForJITLinks.

Definition at line 95 of file MockJobInspectingTask.cs.

95{ set => mJitChecker = value; }

◆ JobInspector

IInspectJob INeedToInspectOtherTasks. MockPlugin.Tasks.JobInspectionDemo.JobInspector
setprivate

The JobInspector lets you see information about other tasks and their properties.

Implements AxelSemrau.Chronos.Plugin.INeedToInspectOtherTasks.

Definition at line 86 of file MockJobInspectingTask.cs.

87 {
88 set => mJobInspector = value;
89 }

The documentation for this class was generated from the following file: