0% found this document useful (0 votes)
8 views

Final - Leverage The Power of Microsoft .NET Technology

The document discusses leveraging Microsoft .NET technology with ArchestrA applications. It provides an agenda that includes using hashtables, handling database readers, common issues with controls, visualizing XML with grids, wrapping complex controls, and hosting InfoPath forms. Code examples are provided for working with hashtables, XML, files, time, and controls. Issues with controls in graphics are discussed along with examples of using controls in graphics.

Uploaded by

Dickson Mora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Final - Leverage The Power of Microsoft .NET Technology

The document discusses leveraging Microsoft .NET technology with ArchestrA applications. It provides an agenda that includes using hashtables, handling database readers, common issues with controls, visualizing XML with grids, wrapping complex controls, and hosting InfoPath forms. Code examples are provided for working with hashtables, XML, files, time, and controls. Issues with controls in graphics are discussed along with examples of using controls in graphics.

Uploaded by

Dickson Mora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 17

Leverage the Power of Microsoft’s .

NET
Technology
Paul Forney - System Architect
Steve Weygandt- ArchestrA Application Consultant
Microsoft .NET scripting
► Maximize connectivity between the
Wonderware System Platform, SQL
databases, Microsoft Office applications
and XML documents.
► Improve communication,
► Set up notification and
► Embed .NET controls.
► Discuss useful scripts and techniques
Agenda
► Using Hashtables
► How to best handle DBReaders through
multiple scans
► Common Issues with AA and .Net Controls
► Show how to use a Data Grid control to
visualize XML
► How to wrap a complex control for use in
AA Graphics
► Use AA Symbols to host InfoPath Forms
► Lot’s of code!!!
The .NET Framework
► The best foundation for building applications on
Windows
► Includes:
▪ The Common Language Runtime (CLR)
▪ The .NET Framework class library, including
• Access to ‘legacy’ COM+ services, e.g., transactions
• ASP.NET
• ADO.NET
• Much more
► Provides strong support for building web services
through SOAP
Illustrating the .NET Framework
SOAP
ASP.NET
IIS

HTTP
Local
User
DBMS
Remote
Calls
.NET Framework Class Library
Common Language Runtime

Windows
Illustrating ADO.NET
► An interface to managed providers
▪ Which can be native or rely on OLE DB
providers
► Key classes in ADO.NET
▪ Connection, Command, DataSet
.NET Framework ADO.NET Managed
Application Provider

Common Language Runtime DBMS


Hashtables
► Find if a value exists in the Hashtable
(ContainsValue).
► Find if a key exists in the Hashtable
(Contains).
► Extract a list of all the Hashtable keys
(loops entire Hashtable).
► Reading Hashtable values using a key
(integer and string key example).
Hashtable Declarations
Dim Hashtable1 As System.Collections.Hashtable;
Dim Hashtable2 As System.Collections.Hashtable;
Dim o As Object;
Hashtable 1 Script
Hashtable1 = new System.Collections.Hashtable;
'Load example data Hashtable1.Add(1,"x");
Hashtable1.Add(2,"y");
Hashtable1.Add(3,"z");
IF Hashtable1.ContainsValue("y") THEN
LogMessage("Found 'y' in Hashtable1");
ENDIF;
IF Hashtable1.Contains(3) THEN
LogMessage("Found '3' in Hashtable1");
ENDIF;
FOR EACH o in Hashtable1.Keys
LogMessage("o.ToString() = " + o.ToString());
NEXT;
FOR EACH o in Hashtable1
LogMessage("o.Key = " + o.Key);
NEXT;
LogMessage("Hashtable1[1] = " + Hashtable1[1]); '---------------------------- ' Hashtable2 Example
Hashtable 2 Script
Hashtable2 = new System.Collections.Hashtable;
'Load example data
Hashtable2.Add("a",1);
Hashtable2.Add("b",2);
Hashtable2.Add("c",3);
LogMessage("Hashtable2[c] = " + Hashtable2["c"]);
-----------------------------------------------------------------------------------------------------------------------
Results:
Found 'y' in Hashtable1
Found '3' in Hashtable1
o.ToString() = 3
o.ToString() = 2
o.ToString() = 1
o.Key = 3
o.Key = 2
o.Key = 1
Hashtable1[1] = x
Hashtable2[c] = 3 ScriptRuntime
Working with XML
dim doc as System.Xml.XmlDocument;
dim node as System.Xml.XmlNode;

doc = new System.Xml.XmlDocument;


doc.LoadXml(MyContainer.WOH.Mgmt.WorkOrdersXML);
for each node in doc.SelectNodes("/WorkOrders/WorkOrder")
If node.SelectSingleNode("State").InnerText == "Active" then
me.RecipeName = node.SelectSingleNode("ProductProductionRuleID").InnerText;
me.WorkOrderID = node.SelectSingleNode("ID").InnerText;
me.RecipeName = node.SelectSingleNode("ProductProductionRuleID").InnerText;
me.BatchID = node.SelectSingleNode("ProductionRequestID").InnerText;
me.SendStartCmd = 1;
Exit For;
Endif;
next;
Working With Files
Dim doc as System.Xml.XmlDocument;
Dim node as System.Xml.XmlNode;
Dim s as String;
Dim path as String;
path = "c:\example.xml";
'Only load the xml file if it exists
IF (System.IO.File.Exists(path)) THEN
doc = new System.Xml.XmlDocument; doc.Load(path);
s = "";
'Select the Example node from the XML file.
node = doc.SelectSingleNode("xml/Example");
IF node <> null THEN
'Read the node text
s = node.InnerText;
ENDIF; IF s <> null THEN
LogMessage("s = " + s);
ENDIF;
ELSE LogMessage("File Not Found");
ENDIF;
Working with Time
Dim t1 as Time;
Dim t2 as Time;
Dim t3 as ElapsedTime;

t3 = t2.Substract(t1);
Issues .Net Controls in AA Graphics
► Font
▪ Font size of 12pt (Unconditionally forced)
▪ Mediation: Specify an override font size in the
properties of the control.
▪ Example: specify the Font property as Arial,
10pt for the aaHistClientQuery control
► Hierarchy of all properties
▪ Not possible to browse the complete hierarchy
of all properties
▪ Mediation: Wrap the control and expose
required properties to the wrapper
▪ Example: Live Demonstration
Let’s Write Some Code!
► Examples using .Net Controls in AA
Graphics:
▪ Simple Data Grid using an XML Data Source
▪ Grid using SQL DB
▪ Custom Formatting
▪ A DataGridView-based symbol which displays
tabular data from XML input
▪ Implementing a menu system using a .Net
custom control and an ArchestrA symbol
Questions?
Powering intelligent plant
decisions in real time.

You might also like