Reference

Design Patterns Index

 

 

Design Patterns are easy to use best-practice samples for common development tasks, programming techniques, and typical protocol features.

 

Other Resources

These Design Patterns are Microsoft C# code samples that utilize core Microsoft.Net features and functionality provided by Stardraw Control.  You can find additional resources on general C# programming in print and online.

 

Read this section and still have a problem you just can't solve or get working?  Someone in the Support Forums or a Certified Programmer may be able to help.

 

Design Patterns

 

Pattern

Reference Topic

Description

Access a Control from Script

Script Component

Exposes a property from a Script Component making it accessible from the Properties Grid at design-time

Access a Device from a Script

About Samples

Controlling devices from within Script Components.

Append String to Byte Array

Serial Data

Appends an ASCII encoded string to end of a byte array.

Building and Formatting Strings

Unidirectional Drivers

Illustrates the uses of the String.Format method and StringBuilder class.

Byte Array to ArrayList

Unidirectional Drivers

How to copy byte arrays, and convert an array to an ArrayList object.

Byte Array to String

Serial Data

Converts an array of bytes to an ASCII string.

Byte Array to Value

Building Packets

Converts an array of bytes to an integer value.

Calculate Checksum

Checksums

Calculates a single-byte basic checksum from an array of bytes

Controllable Property

Write my Own Driver

Makes properties, methods or events in your script accessible to the Actions dialog in the Forms View.

Lock an Object

Multithreading

Advanced.  Allows two or more methods running on separate threads to safely access shared data within a class.

Receive Bytes from a Port

Bidirectional Drivers

How to receive and accumulate incoming bytes from a serial or TCP port.

Receive String from a Port

Bidirectional Drivers

Receiving text strings from a serial or TCP port.

Start and Stop a Thread

Multithreading

Advanced.  How to launch and safely terminate child threads.

String to Byte Array

Serial Data

Converts an ASCII encoded string to an array of bytes.

String to Value

Building Packets

Converts a number encoded as an ASCII string to a value.

Swap Bytes to Network Order

Building Packets

Converts multibyte values between host and network byte-order.

Value to Byte Array

Building Packets

Converts a multibyte integer value to an array of bytes.

Variable/Property/Event

Ports and Functions

Allows controllable read/write access to a propriety, with an event that is fired when the property value changes.

Wait for AutoResetEvent

Multithreading

Advanced.  Shows how one thread can wait to be signalled from another thread, and to time out after a specified period

Write Byte Array to Port

Unidirectional Drivers

Outputs a byte array to a serial or TCP port.

Write String to Port

Unidirectional Drivers

Outputs a text string to a serial or TCP port, with or without end of line terminators.

 

See Also

Ports and Functions

Driver Features