public virtual void RaiseEvent_ActivePresetUpdate(EtcScene Scene) { if (ActivePresetUpdate != null) { ActivePresetUpdate(this, new SceneEventArgs(Scene) { SceneUpdated = Scene }); } }
public etc(string key, string name, IBasicCommunication comm, DeviceConfig dc) : base(key, name) { _Dc = dc; Communication = comm; var socket = comm as ISocketStatus; if (socket != null) { socket.ConnectionChange += new EventHandler <GenericSocketStatusChageEventArgs>(socket_ConnectionChange); } var config = JsonConvert.DeserializeObject <EtcConfigObject>(dc.Properties.ToString()); PortGather = new CommunicationGather(Communication, "\x0D"); PortGather.LineReceived += this.Port_LineReceived; CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 20000, 120000, 300000, "?ETHERNET, 0\x0D"); CommunicationMonitor.Start(); TestTxFeedback = new StringFeedback(() => TestTx); CommandPassThruFeedback = new StringFeedback(() => DeviceRx); ActivePresetFeedback = new StringFeedback(() => ActivePreset); CommandQueue = new CrestronQueue(100); cmdTimer = new CommandTimer(); Scenes = new Dictionary <string, EtcScene>(); if (config.scenes != null) { Debug.Console(2, this, "Zone List Exists"); foreach (KeyValuePair <string, EtcSceneConfig> scene in config.scenes) { string itemkey = scene.Key; var value = scene.Value; Debug.Console(2, this, "Adding: Key: {0} Value Label: {1} Enabled: {2}", itemkey, value.sceneName, value.enabled); EtcScene thisScene = new EtcScene(value, this); Scenes.Add(itemkey, thisScene); } } Initialize(); }
public void Initialize(DeviceConfig dc) { this.ActivePresetUpdate += HandleEvent_ActivePresetUpdate; Scenes = new Dictionary <string, EtcScene>(); var config = JsonConvert.DeserializeObject <EtcConfigObject>(dc.Properties.ToString()); TestTxFeedback = new StringFeedback(() => TestTx); CommandPassThruFeedback = new StringFeedback(() => DeviceRx); if (config.scenes != null) { Debug.Console(2, this, "Zone List Exists"); foreach (KeyValuePair <string, EtcSceneConfig> scene in config.scenes) { string itemkey = scene.Key; var value = scene.Value; Debug.Console(2, this, "Adding: Key: {0} Value Label: {1} Enabled: {2}", value.sceneName, value.enabled); EtcScene thisScene = new EtcScene(value, this); Scenes.Add(itemkey, thisScene); } } }
public SceneEventArgs(EtcScene Value) { SceneUpdated = Value; SceneName = Value.sceneName; }
public void SetSceneByName(string name) { EtcScene thisScene = new EtcScene(null, this); thisScene.SetScene(name); }