See
Also
The following example shows
how to define a .NET component that writes to a windows event
log.
1.
|
In the Definer, select RDMI, dotNet Components from the Define
menu. |
2.
|
Provide a name for your new component, in this case:
EVENTLOG. |
3.
|
In the Program Source field, provide the source code of the
component: |
using System;
using System.Text;
using System.Diagnostics;
class EVENTLOG
{
public static void write(String
message)
{
EventLog log = new EventLog();
log.Log = "USoft";
log.Source = "RDMI";
log.WriteEntry(message);
log.Close();
}
}
4.
|
Type System.dll into the Assembly References field. This
field contains the .NET framework DLL names of libraries referenced
by the code above. In this case the System library is referenced
which resides in System.dll in the .NET framework installation
folder. All the types that you are using in a C# program are
defined in assemblies. Add a reference to the assembly that you use
in the Assembly Reference field. If there are multiple assembly
references use a semicolon (;) as a separator between the assembly
names. |
NOTE:
To ensure that the C# compiler
can find the assembly DLLs, you must add the path of the assemblies
you use to the system path (in both development and production
environments). If you are working with Visual Studio you can find
this path by right clicking on the assembly reference and then
choosing Properties from the context menu. The Path property
contains the path and the name of the assembly. If the assembly DLL
is in the USoft bin directory you do not have to add that path to
the system path.
5.
|
Press Commit. USoft compiles this code. |
6.
|
Press the Check button. The RDMI interface is generated by
USoft. If there are already methods and parameters defined, you
will be asked if you want to generate a new RDMI interface (the old
methods and parameters will be overwritten) or if you just want to
check the existing methods and parameters. |
|