Example, Programming example – Echelon LonWorks Network XML User Manual
Page 56

48
Using the XML Schema
41
Replace
50
Register
51
Unregister
60
Recover
61
MonitorRecovery
VersionNumber
Y Y Specifies
the
plug-in
version.
ManufacturerId
Y Y Specifies the plug-in manufacturer.
Example
Programming Example
The following programming example, written in Visual C# with Microsoft Visual Studio 2008,
demonstrates how to programmatically export a LonMaker drawing, create a LonMaker network with
XML, and then import the XML file into the LonMaker tool. The network created by this example
contains one device that is commissioned, two functional blocks, one network variable in each
functional block, and one connection that binds the network variables.
using
System;
using
System.Collections.Generic;
using
System.IO;
using
System.Text;
using
System.Threading;
using
System.Xml;
using
PlugInWrapper;
//reference to Echelon PluginWrapper.dll file.
//You can use download and reference this assembly instead of
//creating your own director application.
namespace
myLmXmlNetwork
{
class
myLmXmlNetwork
{
static
void
Main(
string
[] args)
{
//Create an instance of the LonMaker plug-in using its registered ActiveX name,
//which is "EchelonLonMakerXML.Application"
LonMakerXmlPlugIn
m_lmXml =
new
LonMakerXmlPlugIn
();
//Set the network name property to open the network
m_lmXml.NetworkName =
"MyNetwork"
;
// **Insert export automation properties before invoking the send command
//Make plug-in visible so it shows itself
m_lmXml.Visible =
true
;
//Export LonMaker drawing to XML file
//Invoke the send command to specify the action and target
//object. The send command uses the following syntax:
//(23, 5, “network/system/subsystem[/subsystem…])”
m_lmXml.SendCommand(23, 5,
"MyNetwork/MyNetwork/Subsystem 1"
);