Chronos Plugins  5.2.0
This documentation covers the plugin interfaces definitions and an example implementation.
MockPlugin.Tasks.ShowSomeGreeting Class Reference

A task which does not need access to the custom device. More...

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

Classes

class  DefaultGreetingsAttribute
 Simple example how to provide a combobox with standard values for a property More...
 

Public Member Functions

void PreValidate ()
 Called before the schedule construction is completed. More...
 
void PostValidate ()
 Called after the schedule construction is completed. More...
 
void Execute ()
 Pretend we are doing some work by showing a message box. More...
 
void DemoExecute ()
 Will be called when the task is executed in demo mode. More...
 
string GetTaskAction ()
 The result of this function will be shown in the timetable. More...
 
void UICultureChanged (System.Globalization.CultureInfo newCulture)
 Switch the resources with localized items to the newly selected culture. More...
 

Properties

string GreetingsText = DefaultGreetingsAttribute.DefGreeting [get, set]
 Parameter which can be edited in the method editor, with some predefined values. More...
 
bool OkThisIsGoodbye [get, set]
 See in .Execute - this is just a flag to tell us if we should stop the schedule. More...
 
Func< StopRunArgs, Task > StopRun [get, set]
 
- Properties inherited from AxelSemrau.Chronos.Plugin.IStopRuns
Func< StopRunArgs, Task > StopRun [set]
 Callback function returning a task that completes once the schedule queue was stopped. More...
 

Events

Action< string > WriteToRunlog
 
EventHandler< TraceWriteEventArgsTraceWrite
 
- Events inherited from AxelSemrau.Chronos.Plugin.IHaveRunlogOutput
Action< string > WriteToRunlog
 Use this event to send output to the Run Control / Runlog page and, if applicable, to the runlog file. More...
 
- Events inherited from AxelSemrau.Chronos.Plugin.ITraceLogger
EventHandler< TraceWriteEventArgsTraceWrite
 Chronos will subscribe to this event and log the text provided in the event args. More...
 

Detailed Description

A task which does not need access to the custom device.

Definition at line 19 of file MockSimpleTask.cs.

Member Function Documentation

◆ DemoExecute()

void MockPlugin.Tasks.ShowSomeGreeting.DemoExecute ( )

Will be called when the task is executed in demo mode.

Implements AxelSemrau.Chronos.Plugin.IDemoAwareTask.

Definition at line 82 of file MockSimpleTask.cs.

83  {
84  System.Windows.Forms.MessageBox.Show(Helpers.Gui.MainWindow,"If we were really executing, we would show something else.", "Demo Execution of Plugin Task");
85  }
IWin32Window MainWindow
If you need to set the owner window yourself or want to show message boxes.
Definition: Helpers.cs:39
Static instance for access to utility functions and resources.
Definition: Helpers.cs:80
static IGuiHelper Gui
Utility functions for window handling
Definition: Helpers.cs:94

References AxelSemrau.Chronos.Plugin.Helpers.Gui, and AxelSemrau.Chronos.Plugin.IGuiHelper.MainWindow.

◆ Execute()

void MockPlugin.Tasks.ShowSomeGreeting.Execute ( )

Pretend we are doing some work by showing a message box.

Also documents this in the runlog.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 66 of file MockSimpleTask.cs.

67  {
68  TraceWrite?.Invoke(this, new TraceWriteEventArgs($"Executing with greeting {GreetingsText}"));
69  WriteToRunlog?.Invoke(string.Format(Properties.LocalizeMockPlugin.ShowingAMessageboxWithTheTextX0, GreetingsText));
70  System.Windows.Forms.MessageBox.Show(Helpers.Gui.MainWindow,
71  "Simple task shows a message:\r\n" + GreetingsText,
72  "Message shown by the mock task",
73  System.Windows.Forms.MessageBoxButtons.OK);
74 
75  // Stop the schedule if this flag was set.
76  if (OkThisIsGoodbye)
77  {
78  StopRun?.Invoke(new StopRunArgs(){How = StopRunArgs.StopMode.NoNewJobs,Reason = "It is time to say goodbye",RestartRemainingJobs = false, StopQueue = false});
79  }
80  }
For future extension (categories, priorities...)
Options for stopping the schedule/queue.
StopMode
Details how to stop the run
Func< StopRunArgs, Task > StopRun
bool OkThisIsGoodbye
See in .Execute - this is just a flag to tell us if we should stop the schedule.
EventHandler< TraceWriteEventArgs > TraceWrite
string GreetingsText
Parameter which can be edited in the method editor, with some predefined values.

References MockPlugin.Tasks.ShowSomeGreeting.GreetingsText, AxelSemrau.Chronos.Plugin.Helpers.Gui, AxelSemrau.Chronos.Plugin.IGuiHelper.MainWindow, MockPlugin.Tasks.ShowSomeGreeting.OkThisIsGoodbye, MockPlugin.Tasks.ShowSomeGreeting.StopRun, MockPlugin.Tasks.ShowSomeGreeting.TraceWrite, and MockPlugin.Tasks.ShowSomeGreeting.WriteToRunlog.

◆ GetTaskAction()

string MockPlugin.Tasks.ShowSomeGreeting.GetTaskAction ( )

The result of this function will be shown in the timetable.

Returns

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 91 of file MockSimpleTask.cs.

92  {
93  return $"Just shows a message box with {GreetingsText}{(OkThisIsGoodbye ? ", then makes the schedule stop.": "")}";
94  }

◆ PostValidate()

void MockPlugin.Tasks.ShowSomeGreeting.PostValidate ( )

Called after the schedule construction is completed.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 57 of file MockSimpleTask.cs.

58  {
59  System.Windows.Forms.MessageBox.Show(Helpers.Gui.MainWindow,"PostValidate");
60  }

References AxelSemrau.Chronos.Plugin.Helpers.Gui, and AxelSemrau.Chronos.Plugin.IGuiHelper.MainWindow.

◆ PreValidate()

void MockPlugin.Tasks.ShowSomeGreeting.PreValidate ( )

Called before the schedule construction is completed.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 52 of file MockSimpleTask.cs.

53  {
54  System.Windows.Forms.MessageBox.Show(Helpers.Gui.MainWindow,"PreValidate");
55  }

References AxelSemrau.Chronos.Plugin.Helpers.Gui, and AxelSemrau.Chronos.Plugin.IGuiHelper.MainWindow.

◆ UICultureChanged()

void MockPlugin.Tasks.ShowSomeGreeting.UICultureChanged ( System.Globalization.CultureInfo  newCulture)

Switch the resources with localized items to the newly selected culture.

Parameters
newCulture

Definition at line 104 of file MockSimpleTask.cs.

105  {
106  Properties.LocalizeMockPlugin.Culture = newCulture;
107  }

Property Documentation

◆ GreetingsText

string MockPlugin.Tasks.ShowSomeGreeting.GreetingsText = DefaultGreetingsAttribute.DefGreeting
getset

Parameter which can be edited in the method editor, with some predefined values.

Definition at line 29 of file MockSimpleTask.cs.

29 { get; set; } = DefaultGreetingsAttribute.DefGreeting;

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

◆ OkThisIsGoodbye

bool MockPlugin.Tasks.ShowSomeGreeting.OkThisIsGoodbye
getset

See in .Execute - this is just a flag to tell us if we should stop the schedule.

Definition at line 34 of file MockSimpleTask.cs.

34 { get; set; }

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

◆ StopRun

Func<StopRunArgs, Task> MockPlugin.Tasks.ShowSomeGreeting.StopRun
getset

Definition at line 109 of file MockSimpleTask.cs.

109 { get; set; }

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

Event Documentation

◆ TraceWrite

EventHandler<TraceWriteEventArgs> MockPlugin.Tasks.ShowSomeGreeting.TraceWrite

Definition at line 98 of file MockSimpleTask.cs.

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

◆ WriteToRunlog

Action<string> MockPlugin.Tasks.ShowSomeGreeting.WriteToRunlog

Definition at line 96 of file MockSimpleTask.cs.

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


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