XMLDA.NET Sample Application
ASP.NET Application with Visual Basic code behind that uses DataBind subscriptions
|
DataBind subscriptions are defined from a ListBuilder created XML file. The DataBind subscriptions work in combination with the ASP.NET DataBind feature to update a CheckBox from a binary OPC-DA or XML-DA server item value, a ListBox with an array item value and TextBoxes with integer values.
|
'Shared OpcURL As String = "http://localhost/OpcXmlGateway/OpcDaGateway.asmx"
Shared OpcURL As String = "OCSTK.DA.Sim.32"
Private Shared OpcSrv As XmlServer
'-----------------------------------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Put user code to initialize the page here
If Not IsPostBack Then
chkStopped.Checked = False
OpcSrv = New XmlServer(OpcURL)
Dim err As OPCError()
Dim subscr As DataBindSubscription()
OpcSrv.DataBindFromXmlFile(Me, "AspDemo1.xml", "Demo1", Nothing, 1000, Nothing, subscr, err)
End If
DataBind()
End Sub
'------------------------------------------------------
' method used in DataBind definitons
Public Function GetOpcItemValue(ByVal SubscrID As String) As Object
If OpcSrv Is Nothing Then
Return ""
End If
Return OpcSrv.GetBindValue(SubscrID)
End Function
'------------------------------------------------------
Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
' only postback handling is required
End Sub
Private Sub chkStopped_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles chkStopped.CheckedChanged
Dim err As OPCError()
OpcSrv.DataBindCancel(Nothing, Nothing, err)
End Sub
|
|