Chronos Plugins 5.11.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
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.
void PostValidate ()
 Called after the schedule construction is completed.
void Execute ()
 Pretend we are doing some work by showing a message box.
void DemoExecute ()
 Will be called when the task is executed in demo mode.
string GetTaskAction ()
 The result of this function will be shown in the timetable.
void UICultureChanged (System.Globalization.CultureInfo newCulture)
 Switch the resources with localized items to the newly selected culture.

Properties

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

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.
Events inherited from AxelSemrau.Chronos.Plugin.ITraceLogger
EventHandler< TraceWriteEventArgsTraceWrite
 Chronos will subscribe to this event and log the text provided in the event args.

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 }

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 }

References GreetingsText, AxelSemrau.Chronos.Plugin.Helpers.Gui, AxelSemrau.Chronos.Plugin.IGuiHelper.MainWindow, OkThisIsGoodbye, StopRun, TraceWrite, and 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 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 Execute().

◆ StopRun

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

Callback function returning a task that completes once the schedule queue was stopped.

Implements AxelSemrau.Chronos.Plugin.IStopRuns.

Definition at line 109 of file MockSimpleTask.cs.

109{ get; set; }

Referenced by Execute().

Event Documentation

◆ TraceWrite

EventHandler<TraceWriteEventArgs> MockPlugin.Tasks.ShowSomeGreeting.TraceWrite

Definition at line 98 of file MockSimpleTask.cs.

Referenced by Execute().

◆ WriteToRunlog

Action<string> MockPlugin.Tasks.ShowSomeGreeting.WriteToRunlog

Definition at line 96 of file MockSimpleTask.cs.

Referenced by Execute().


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