Click or drag to resize

ISmartObjectLoadSmartObjects(Stream) Method

Load a smart object given a reference to a stream for the SGD file.

Namespace: Crestron.SimplSharpPro.DeviceSupport
Assembly: SimplSharpPro (in SimplSharpPro.dll) Version: 2.21.121
Syntax
C#
uint LoadSmartObjects(
	Stream paramSgdStream
)

Parameters

paramSgdStream  Stream
A stream object resource for the SGD file.

Return Value

UInt32
The number of smart objects loaded.
Exceptions
ExceptionCondition
InvalidOperationExceptionSmartObjects are already loaded for this device.
IOExceptionError processing SmartObject information.
Example
The following will load SmartObjects from a MemoryStream.
C#
MemoryStream memStream;
//Populate a memory stream with an sgd off the file system.
using (var filestream = new FileStream(Directory.GetApplicationDirectory() + "\\xPanel.sgd", FileMode.Open, FileAccess.Read))
{
    var fileBytes = new byte[filestream.Length];
    filestream.Read(fileBytes, 0, (int)filestream.Length);
    memStream = new MemoryStream((int)filestream.Length);
    memStream.Write(fileBytes, 0, (int)filestream.Length);
    memStream.Seek(0, SeekOrigin.Begin);
}

//Create a new panel
var sgPanel = new XpanelForSmartGraphics(0x30, this);
//Load SmartObjects from the memory stream.
sgPanel.LoadSmartObjects(memStream);

Version Information

.NET

Supported in: 6.0

.NET Compact Framework

Supported in: 3.5
See Also