/// <summary> /// Create an instance of a system for use on a CrestronControlSystem /// </summary> protected SystemBase(CrestronControlSystem controlSystem, Assembly appAssembly) { BootStatus = "Waiting for System.ctor()"; _controlSystem = controlSystem; _appAssembly = appAssembly; CrestronEnvironment.ProgramStatusEventHandler += type => { _programStopping = type == eProgramStatusEventType.Stopping; try { _systemWait.Set(); } catch (Exception e) { CloudLog.Error("Error calling _systemWait.Set() on program stop", e.Message); } try { _startupWait.Set(); } catch (Exception e) { CloudLog.Error("Error calling _startupWait.Set() on program stop", e.Message); } }; Displays = new DisplayCollection(); Sources = new SourceCollection(); Rooms = new RoomCollection(); UIControllers = new UIControllerCollection(this); Debug.WriteInfo("Checking for new app version"); AppIsNewVersion = CheckIfNewVersion(appAssembly); if (AppIsNewVersion) { Debug.WriteWarn("New Version", "version = {0}, running upgrade scripts...", appAssembly.GetName().Version.ToString()); // ReSharper disable once DoNotCallOverridableMethodsInConstructor AppShouldRunUpgradeScripts(); } CrestronConsole.AddNewConsoleCommand(parameters => FusionRVI.GenerateFileForAllFusionDevices(), "RviGenerate", "Create RVI file for Fusion", ConsoleAccessLevelEnum.AccessOperator); }
public FusionManager(CrestronControlSystem cs, uint ipid, string roomName) { try { this.cs = cs; Trace("Constructor running."); // create new FusionRoom object string roomID = new Guid().ToString(); room = new FusionRoom(ipid, cs, roomName, roomID); // add assets AddAssets(); // add event handlers room.OnlineStatusChange += new OnlineStatusChangeEventHandler(OnlineStatusChange); room.FusionStateChange += new FusionStateEventHandler(FusionStateChange); room.FusionAssetStateChange += new FusionAssetStateEventHandler(AssetStateChange); // generate rvi file FusionRVI.GenerateFileForAllFusionDevices(); // attempt to register eDeviceRegistrationUnRegistrationResponse response = room.Register(); if (response == eDeviceRegistrationUnRegistrationResponse.Success) { Trace("Room registered successfully."); } else { Trace("Room failed to register: " + response); } } catch (Exception e) { string traceMessage = "Exception caught in constructor: " + e.Message + e.StackTrace; Trace(traceMessage); ErrorLog.Error(traceMessage); } }
/// <summary> /// Overridden function... Invoked before any traffic starts flowing back and forth between the devices and the /// user program. /// This is used to start all the user threads and create all events / mutexes etc. /// This function should exit ... If this function does not exit then the program will not start /// </summary> public override void InitializeSystem() { // this method should be called after all of the fusion room devices have been created, and assets/attributes are added to them // this is what generates the *.rvi file in the project directory at start up (used for autodiscover) FusionRVI.GenerateFileForAllFusionDevices(); }