Software
Customisation User Guide
PML.NET
PML.NET
PML.NET is used to instantiate and invoke methods on .NET objects from PML proxy objects. PML proxy class definitions are created from .NET class definitions at run time. These proxy classes present the same methods as the .NET class which are described using custom attributes. Proxy methods are passed arguments of known types which are marshalled to the corresponding method on to the .NET instance. The PML proxy objects behave just like any other PML object.
The PML.NET functionality includes:
•
.NET reflection to create PML class definition
•
Creation of a proxy PML instance which behaves just like any other PML object
•
Mixing of PML and .NET assemblies and access to .NET objects from PML
•
Extensible Hybrid GUI with .NET controls
•
PML customisation using events
The example displays PMLNetCallable class code:
using System;
using Aveva.PDMS.PMLNet;
namespace Aveva.PDMS.PMLNetTest
{
[PMLNetCallable()]
public class PMLNetObject
[PMLNetCallable()]
public PMLNetObject()
{
}
[PMLNetCallable()]
public void Test()
{
MessageBox.Show(“Message”);
}
}
}
The .NET class is instatiated using the
Command Window
.
Resulting in the display of the following window:
PMLUserControl
The example displays PMLNetCallable user control code which is used to prepend the class deinition:
[PMLNetCallable()]
public class GridControl : System.Windows.Forms.UserControl
{
}
PML Form
The example displays PMLNetCallable form control code which is used to create the window:
import 'GridControl'
handle any
endhandle
setup form !!MyForm resize
using namespace 'Aveva.Pdms.Presentation'
member .grid is NetGridControl
path down
container .gridFrame PmlNetControl 'grid' dock fill width 30 height 20
Exit
The example displays PMLNetCallable form control code which is used to display the window:
show !!MyForm
Call PML from Managed Code
PMLNetAny any = PMLNetAny.createInstance(“PMLObject”, args, 0);
define object PMLObject
member .name is STRING
endobject
define method .PMLObject()
!this.name = 'PMLObject'
endmethod
define method .PMLMethod()
…
endmethod
any.invokeMethod(“PMLMethod”, args, 0, ref result);
define method.PMLMethod()
…
endmethod
Detailed information about PMLNet is available, refer to
Data Model Definition Classes
for further information.
1974 to current year.
AVEVA Solutions Limited and its subsidiaries. All rights reserved.