Click or drag to resize

Tpmc9BaseLoadSmartObjects(Stream) Method

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

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

Parameters

paramSgdStream  Stream
A stream object resource for the SGD file.

Return Value

UInt32
The number of smart objects loaded.

Implements

ISmartObjectLoadSmartObjects(Stream)
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 Tpmc9(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