Uploaded by Amr Elsharkawy

.NET Class Library (C#) Example and How to Use it in IndustrialApplication Script tn000022428

advertisement
Doc Type
Tech Notes
Doc Id
TN000022428
Legacy Doc Id
TN83
Publish Date
2/19/2019
.NET Class Library (C#) Example and How to Use it in IndustrialApplication Script
PROBLEM
Title
.NET Class Library (C#) Example and How to Use it in IndustrialApplication Script
SOLUTION
Summary
This Tech Note demonstrates how to use a C# class library method in Industrial Application Object Script. The .NET Class library and its source
code is also included for reference.
Note: The class library is developed in C# using VisualStudio 2003. Industrial Application server 2.0 is used for testing this demo. A default printer
must be installed on the machine where the ArshestrA Object is deployed.
Situation
About C# Class Library - PrintingExample.dll
A class - PrintDocClass is developed with a method - TestPrint. The method prints a file, the filename is passed with the complete path, as
parameter to theTestPrint method.
This example uses the PrintDocument Class from System.Drawing.Printing namespace.
Download Printing Example C++ Source. This is a zip file containing the source code.
Download Printing Example DLL. This is a zip file containing the PrintingExample.dll
Using the c# Class Library Method "TestPrint" in an ApplicationServer Object Script
Import the Script Function Library - PrintingExample.dll using the ArchestrA IDE
1.
2.
3.
4.
Select Import/Script Function Library from the Galaxy menu in the ArchestrA IDE.
In the Import Script Function Library dialog box, browse to locate the PrintingExample.dll.
Select it and click Open.
Click OK in the final message box.
The Galaxy imports the PrintingExample.dll library and makes its method available to the IDE.
Using the Method TestPrint in the ArchestrA Object Script
dim myPrnObject as PrintingExample.PrintDocClass;
myPrnObject = new PrintingExample.PrintDocClass;
myPrnObject.TestPrint( "c:\MyFile.txt" );
For the detailed procedure on creating and associating a script with anobject, please refer to IDE Online Help file: Enhancing an
Object'sFunctionality/Scripting Scripts page.
Refer to the Section To create and associate a script with an object.
© 2019 AVEVA Group plc and its subsidiaries.All rights reserved.
Terms of Use| Privacy Policy
Note: The Printer must be installed with a Network User Account and have all privileges from the Platform that the script isrunning on. If this is not
the case, the error Printers NotInstalled appears in the Logviewer.
© 2019 AVEVA Group plc and its subsidiaries.All rights reserved.
Terms of Use| Privacy Policy
Download