.NET Code (Magic xpa 2.x)
The .NET Code dialog box includes the following fields:
|
|
.NET Language
|
Determines whether the code is compiled in C# or VB.NET.
Since version: 1.8 SP1
|
Compile for Mobile
|
If this check box is selected, the code is compiled for compact framework. If the Compact Framework is not installed on your computer, this check box is disabled.
Platform specific: This is supported for Windows Mobile only.
Since version: 1.8 SP1
|
Method Name
|
This will appear as the function name. If you change the name here, it will also change in the .NET Code section. The first character must be either a letter or an underscore.
|
Arguments
|
Displays the number of arguments defined in the Argument repository.
You can zoom from this field to access the Argument repository.
|
Return Value Type
|
The function's return value type. If you change the name here, it will also change in the .NET Code section.
You can press Ctrl+Space to manually open the Automatic Complete list, which shows the available classes.
You can use ‘void’ if the function does not return a value.
|
Return Value
|
The variable that will get the function's returned value.
You can zoom from this field to access the Variable list.
|
.NET Code area
|
Displays the .NET code. You can edit the code in this area and can change the method name or return value type by changing it in the corresponding fields above. You can add additional code and functions.
You can copy the entire section and paste it in Visual Studio – so it can be compiled and checked there if required.
See also .NET Code - Keyboard Shortcuts.
|
When you click OK, Magic xpa does not generate a .NET assembly, but passes the .NET code to the .NET compiler, which is provided as part of the .NET framework. The compiler compiles the code according to the .NET language you specified. If there are compilation errors in your code you will receive an error message.
The compiler returns the compiled code back to Magic xpa and the Magic xpa Studio saves the compiled code in Base64 as part of the task source code. During deployment, the compiled code is passed back to the client where it is executed.
Note:
-
Aliases that you created in the CRR are not valid here. However, you can utilize the ‘Using’ operation as a shortcut, which is standard for .NET code, such as Using Systems.Windows.Forms.
-
The .NET Code section provides pure .NET capabilities. There are a number of keyboard shortcuts available that are only available in this section.
-
You can use the auto-complete mechanism as with regular Magic xpa .NET functionality.
-
You cannot use Magic xpa functions or variables, since they are unknown to .NET.
-
You cannot directly refer to objects that were defined in the Magic xpa code. These objects will need to be passed as parameters.
-
The Magic xpa Text Search will also find text in this section.