![]() |
VOOZH | about |
dotnet add package Crestron.SimplSharp.SDK.ProgramLibrary --version 2.21.257
NuGet\Install-Package Crestron.SimplSharp.SDK.ProgramLibrary -Version 2.21.257
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.257" />
<PackageVersion Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.257" />Directory.Packages.props
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" />Project file
paket add Crestron.SimplSharp.SDK.ProgramLibrary --version 2.21.257
#r "nuget: Crestron.SimplSharp.SDK.ProgramLibrary, 2.21.257"
#:package Crestron.SimplSharp.SDK.ProgramLibrary@2.21.257
#addin nuget:?package=Crestron.SimplSharp.SDK.ProgramLibrary&version=2.21.257Install as a Cake Addin
#tool nuget:?package=Crestron.SimplSharp.SDK.ProgramLibrary&version=2.21.257Install as a Cake Tool
<p align="center"><img src="images/crestron_logo_nuget.jpg"></p> <h1 align="center"> Crestron.SimplSharp.SDK.Program</a></h1> <p align="center">Crestron's 4-Series appliances and server based Virtual Control enable you to program your system in C#. This package includes all the necessary libraries needed to create a C# Program that runs on 4-Series or Virtual Control.</p>
To program your Crestron system in C#, follow these steps:
Install the package via NuGet. You can use the following command in the Package Manager Console:
dotnet add package Crestron.SimplSharp.SDK.Program
Import these namespaces in your code file(s) at a minimum:
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
Depending on your application and the devices used, you might need to import additional namespaces.
Create a class that inherits from CrestronControlSystem and add a parameterless constructor: The constructor needs to exit in a timely fashion, otherwise the program will exit. You cannot send/receive data in the constructor
public class ControlSystem : CrestronControlSystem
{
public ControlSystem() : base()
{
try
{
// Initialize Crestron threadpool
Crestron.SimplSharpPro.CrestronThread.Thread.MaxNumberOfUserThreads = 20;
}
catch (Exception e)
{
ErrorLog.Error("Error in the constructor: {0}", e.Message);
}
}
}
Use the constructor to:
Add InitializeSystem() This method gets called after the constructor has finished. InitializeSystem() needs to exit in a timely fashion, otherwise the program will exit.
public override void InitializeSystem()
{
try
{
}
catch (Exception e)
{
ErrorLog.Error("Error in InitializeSystem: {0}", e.Message);
}
}
Use InitializeSystem to:
Subscribe to controller events
Program Status Events Event handler for programmatic events, such as program stop, pause, and resume. Handling the program stopping scenario is mandatory.
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(ControllerProgramEventHandler);
void ControllerProgramEventHandler(eProgramStatusEventType programStatusEventType)
{
switch (programStatusEventType)
{
case (eProgramStatusEventType.Paused):
// The program has been paused. Pause all user threads/timers as needed.
break;
case (eProgramStatusEventType.Resumed):
// The program has been resumed. Resume all the user threads/timers as needed.
break;
case (eProgramStatusEventType.Stopping):
// The program has been stopped.
// Close all threads.
// Shutdown all Client/Servers in the system.
// General cleanup.
// Unsubscribe to all System Monitor events
break;
}
}
OPTIONAL: System Events Event handler for system events, such as disk inserted/ejected, and system reboot
CrestronEnvironment.SystemEventHandler += new SystemEventHandler(ControllerSystemEventHandler);
void ControllerSystemEventHandler(eSystemEventType systemEventType)
{
switch (systemEventType)
{
case (eSystemEventType.DiskInserted):
// Removable media was detected on the system
break;
case (eSystemEventType.DiskRemoved):
// Removable media was detached from the system
break;
case (eSystemEventType.Rebooting):
// The system is rebooting.
// Very limited time to preform clean up and save any settings to disk.
break;
}
}
OPTIONAL: Ethernet Events Event handler for ethernet events, such as link up / link down
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(ControllerEthernetEventHandler);
void _ControllerEthernetEventHandler(EthernetEventArgs ethernetEventArgs)
{
switch (ethernetEventArgs.EthernetEventType)
{
//Determine the event type Link Up or Link Down
case (eEthernetEventType.LinkDown):
//Next need to determine which adapter the event is for.
//LAN is the adapter is the port connected to external networks.
if (ethernetEventArgs.EthernetAdapter == EthernetAdapterType.EthernetLANAdapter)
{
}
break;
case (eEthernetEventType.LinkUp):
if (ethernetEventArgs.EthernetAdapter == EthernetAdapterType.EthernetLANAdapter)
{
}
break;
}
}
Additional documentation can be found <a href="https://community.crestron.com/s/article/id-1000637">here</a></p>
This project is licensed under the .
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Framework | net47 net47 is compatible. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
Showing the top 5 NuGet packages that depend on Crestron.SimplSharp.SDK.ProgramLibrary:
| Package | Downloads |
|---|---|
|
PepperDash.Essentials.Core
Package Description |
|
|
PepperDash.Essentials.Devices.Common
Package Description |
|
|
UXAV.AVnet.Core
Package Description |
|
|
Crestron.SimplSharp.SDK.Program
Crestron's 4-Series appliances and server based Virtual Control enable you to program your system in C#. This package includes all the necessary libraries needed to create a C# Program that runs on 4-Series or Virtual Control. |
|
|
PepperDash.Essentials.MobileControl.Messengers
Package Description |
Showing the top 1 popular GitHub repositories that depend on Crestron.SimplSharp.SDK.ProgramLibrary:
| Repository | Stars |
|---|---|
|
PepperDash/Essentials
The Essentials Application Framework Libraries
|
| Version | Downloads | Last Updated |
|---|---|---|
| 2.21.257 | 582 | 6/2/2026 |
| 2.21.252 | 505 | 5/12/2026 |
| 2.21.237 | 1,483 | 3/31/2026 |
| 2.21.226 | 878 | 3/3/2026 |
| 2.21.184 | 1,711 | 12/23/2025 |
| 2.21.182 | 553 | 12/17/2025 |
| 2.21.177 | 878 | 12/9/2025 |
| 2.21.171 | 2,250 | 10/14/2025 |
| 2.21.157 | 2,536 | 9/9/2025 |
| 2.21.133 | 1,476 | 7/29/2025 |
| 2.21.128 | 2,853 | 7/1/2025 |
| 2.21.121 | 1,547 | 6/3/2025 |
| 2.21.110 | 2,471 | 4/23/2025 |
| 2.21.90 | 13,915 | 12/26/2024 |
| 2.21.68 | 18,252 | 11/12/2024 |
| 2.21.65 | 6,370 | 10/30/2024 |
| 2.21.54 | 7,052 | 10/9/2024 |
| 2.20.66 | 17,685 | 4/30/2024 |
| 2.20.63 | 5,762 | 4/23/2024 |