Info |
---|
...
title | info |
---|
...
Download the |
...
- Project Name: TasksAndClasses
- Software Version: 9.2 sp2 (9.2.26)
- Keywords: Script. Tasks. Classes.
Project Summary
This project example shows the use of Tasks and Classes.
Technical Information
All of the programming in FactoryStudio consists of C# or Visual Basic 100% managed code that is designed to run in the Microsoft .NET framework. These languages are used to create Scripts that run periodically or when specified events occur.
Tasks are program units, written in VB.Net or C#, that execute either when a trigger event occurs or periodocally at specified intervals. FactoryStudio includes the following built-in Tasks:
ServerStartup, ServerShutdown, ClientStartup, ClientShutdown. To configure Tasks go to Scripts > Tasks.
Classes let you create a repository of class libraries, methods, and functions that you can use across the application. You can call them from Tasks, other Classes, and displays (code behind).
FactoryStudio comes with the following built-in classes: ServerMain and ClientMain. To configure classes go to Scripts > Classes.
Reference Information
...
solution ScriptTasksAndClasses.dbsln Built with v10. This example shows how to use Tasks and Classes to create custom logic. |
Summary
This solution example shows the basic concepts on using Tasks and Classes to create custom logic in your solution.
Technical Information
The platform is fully programmed using managed C# or Visual Basic code within the Microsoft .NET framework, enabling the creation of scripts that execute on a schedule or in response to specific events. Tasks, written in VB.NET or C#, are triggered either by specific events or at designated intervals, and can be configured under Scripts / Tasks. Additionally, Classes provide a repository for reusable class libraries, methods, and functions, which can be accessed by Tasks, other Classes, or displays, streamlining application-wide functionality.
This solution example demonstrates five different ways to access scripts or tasks.
The first one shows a message box popup using a script.
The button above runs a script in the CodeBehind. The code in the CodeBehind uses the @Script.Class
method to call a class that was previously set up. The code snippet used in the CodeBehind can be found below:
Code Block | ||
---|---|---|
| ||
Public Sub MouseLeftButtonDown1(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs)
' You can find the logic related to "MyClass" on Scripts ? Classes ? MyClass
@Script.Class.MyClass.Hello(@Tag.sayit)
End Sub |
For the second button, it calls a class through expressions written in VB.NET.
The way it works is through “Run Expression” in the Action tab in the Dynamics window, and it calls the function in a similar way as before:
Code Block | ||
---|---|---|
| ||
Script.Class.MyClass.Hello2(Tag.sayit) |
The third button works through the use of a trigger.
This trigger is configured in the Tasks page to call a method, and through this intermediary, the counter is incremented by one when the task is called.
The fourth panel does not have a button. However, it uses a trigger that is triggered every second. It is also set up in the Tasks page.
Lastly, the Counter (Class) panel also works as a counter, but its implementation is done through a class that passes the current value as a parameter.
After receiving the parameter, it increments the tag and updates the display.
Along with that information, the solution example also contains information boxes that can lead you to the exact parts of the code where they get triggered. These information boxes can be found in each individual panel, and clicking on them will provide you with the desired information.
Reference
for more information.
In this section
...
:
Page Tree | ||||
---|---|---|---|---|
|