void ui_SigChange(BasicTriList currentDevice, SigEventArgs args) { Sig sig = args.Sig; OnDebug(eDebugEventType.Info, "{0} SigChange in {1} type: {2}, sig: {3}, Name: {4}", currentDevice.ToString(), currentDevice.ID.ToString(), sig.Type.ToString(), sig.Number.ToString(), sig.Name); switch (sig.Type) { case eSigType.Bool: if (sig.BoolValue) // press { OnDebug(eDebugEventType.Info, "Press event on sig number: {0}", sig.Number); switch (sig.Number) { case DIG_TOGGLE_POWER: UI.ToggleDigitalJoin(currentDevice, sig.Number); break; case DIG_MACRO: UI.PulseDigitalJoin(currentDevice, DIG_TOGGLE_POWER); var randomNumber = new Random().Next(ushort.MaxValue); UI.SetAnalogJoin(currentDevice, ANA_RANDOM, (ushort)randomNumber); UI.SetSerialJoin(currentDevice, SER_VALUE, randomNumber.ToString()); break; } } else // release { } break; case eSigType.UShort: OnDebug(eDebugEventType.Info, "UShortValue: {0}", sig.UShortValue.ToString()); switch (sig.Number) { case ANA_BAR_GRAPH: UI.SetAnalogJoin(currentDevice, sig.Number, sig.UShortValue); UI.SetSerialJoin(currentDevice, SER_VALUE, sig.UShortValue.ToString()); break; case ANA_RANDOM: UI.SetAnalogJoin(currentDevice, ANA_BAR_GRAPH, sig.UShortValue); break; } break; case eSigType.String: OnDebug(eDebugEventType.Info, "StringValue: {0}", sig.StringValue); switch (sig.Number) { case SER_INPUT: UI.SetSerialJoin(currentDevice, SER_VALUE, sig.StringValue.ToString()); break; } break; default: OnDebug(eDebugEventType.Info, "Unhandled sig type: {0}", sig.Type.ToString()); break; } }
void userInterface_SigChange(BasicTriList currentDevice, SigEventArgs args) { switch (args.Sig.Type) { //Digital case eSigType.Bool: { if (args.Sig.BoolValue) { if (args.Sig.Number == 101) { userInterface.BooleanInput[101].BoolValue = true; } else if (args.Sig.Number == 100) { userInterface.BooleanInput[101].BoolValue = false; } } break; } //Analog case eSigType.UShort: { break; } //Serial case eSigType.String: { break; } } }
private void activityDetectionHandler(BasicTriList currentDevice, SigEventArgs args) { if (AuthenticatedLevel != AuthenticatedLevel.None && args.Sig.Type == eSigType.Bool && args.Sig.BoolValue && args.Sig.Number < 17000) { _inactivityTimer.Reset(_inactivityTime); } }
/// <summary> /// Called once a sig change occurs on a device /// </summary> /// <param name="currentDevice">This device</param> /// <param name="args">The SigEventArgs</param> protected virtual void OnSigChange(GenericBase currentDevice, SigEventArgs args) { if (args.Event == eSigEvent.BoolChange && this.PressDigitalJoin != null && args.Sig == this.PressDigitalJoin) { if (args.Sig.BoolValue) { OnPress(); } else { OnRelease(); } } else if (args.Event == eSigEvent.BoolChange && this.VisibleFeedbackJoin != null && args.Sig == this.VisibleFeedbackJoin) { #if DEBUG CrestronConsole.PrintLine("{0}.OnSigChange - VisibleFeedbackJoin {1} = {2}", GetType().Name, VisibleFeedbackJoin.Number, VisibleFeedbackJoin.BoolValue); #endif Visible = args.Sig.BoolValue; } else if (args.Event == eSigEvent.BoolChange && this.TransitionCompleteDigitalJoin != null && args.Sig == this.TransitionCompleteDigitalJoin) { if (args.Sig.BoolValue) { OnTransitionComplete(); } } else if (args.Event == eSigEvent.UShortChange && this.AnalogTouchJoin != null && args.Sig == this.AnalogTouchJoin) { OnValueChange(args.Sig.UShortValue); new Thread(ValueRampThread, args.Sig); } }
public void Eisc_SigChange(BasicTriList currentDevice, SigEventArgs args) { switch (args.Sig.Type) { case eSigType.Bool: switch (args.Sig.Number) { case 7: // ErrorLog.Notice(String.Format(LogHeader + "Got remote vol pop")); // here we use a digital from a remote system to display the volume bar remote01.PageActiveFeedback.ShowVolumeSubpage.BoolValue = args.Sig.BoolValue; break; case 16: // show the mute "subpage" on the MLX3 remote01.PageActiveFeedback.ShowMuteSubpage.BoolValue = args.Sig.BoolValue; break; } break; case eSigType.String: break; case eSigType.UShort: switch (args.Sig.Number) { case 1: ushort volumeLevel = Convert.ToUInt16(args.Sig.UShortValue / 655.35); remote01.PageActiveFeedback.VolumeLevel(volumeLevel); // There seems to be an issue on the MLX3 - the volume bar graph does not populate. But otherwise, this line should work. break; } break; } }
/// <summary> /// Handles incoming sig changes /// </summary> /// <param name="currentDevice"></param> /// <param name="args"></param> void Eisc_SigChange(object currentDevice, SigEventArgs args) { try { if (Debug.Level >= 1) { Debug.Console(1, this, "EiscApiAdvanced change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); } var uo = args.Sig.UserObject; if (uo == null) { return; } Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); if (uo is Action <bool> ) { (uo as Action <bool>)(args.Sig.BoolValue); } else if (uo is Action <ushort> ) { (uo as Action <ushort>)(args.Sig.UShortValue); } else if (uo is Action <string> ) { (uo as Action <string>)(args.Sig.StringValue); } } catch (Exception e) { Debug.Console(2, this, "Error in Eisc_SigChange handler: {0}", e); } }
//Event handlers void _xpanel_SigChange(BasicTriList currentDevice, SigEventArgs args) { if (args.Event == eSigEvent.BoolChange && args.Sig.BoolValue) { if (args.Sig.Number == 12) { _receiver.RxHandler.Identify = !_receiver.RxHandler.Identify; } else if (args.Sig.Number == 13) { _receiver.RxHandler.MuteSwitchActive = !_receiver.RxHandler.MuteSwitchActive; } else if (args.Sig.Number == 22) { _receiver.AudioHandler.LowCut = !_receiver.AudioHandler.LowCut; } else if (args.Sig.Number >= 23 && args.Sig.Number <= 29) { _receiver.AudioHandler.OutputGain = (SldwAudioHandler.eSldwAudioOutputGain)(args.Sig.Number - 23); } else if (args.Sig.Number >= 30 && args.Sig.Number <= 34) { _receiver.AudioHandler.Eq = (SldwAudioHandler.eSldwAudioEq)(args.Sig.Number - 30); } } else if (args.Event == eSigEvent.UShortChange) { if (args.Sig.Number == 15) { _receiver.DeviceHandler.Brightness = args.Sig.UShortValue / 65535.0; } } }
private void InterfaceSigChange(BasicTriList currentDevice, SigEventArgs args) { switch (args.Sig.Type) { case eSigType.Bool: if (args.Sig.BoolValue) { // Print results to console CrestronConsole.PrintLine("Result of display configuration build:"); foreach (IDisplay d in displays) { CrestronConsole.PrintLine("{0} - pwr={1}; mute={2}", d.ID, d.Power, d.ShowVideo); } } break; case eSigType.String: break; case eSigType.UShort: break; case eSigType.NA: default: break; } }
protected override void panel_SigChange(BasicTriList currentDevice, SigEventArgs args) { base.panel_SigChange(currentDevice, args); if (args.Sig.Type == eSigType.String && _textEntry == (SerialRelativeJoin(args.Sig.Number))) { _text = SerialJoinGet(_textEntry); } }
protected override void OnSigChange(GenericBase currentDevice, SigEventArgs args) { if (this.TimeOut != null) { this.TimeOut.Reset(); } base.OnSigChange(currentDevice, args); }
void panel_SigChange(BasicTriList currentDevice, SigEventArgs args) { //CrestronConsole.PrintLine("{0}: Event:{1} Type:{2} Number:{3}", currentDevice.Name, args.Event, args.Sig.Type, args.Sig.Number); if (args.Sig.Type == eSigType.Bool && args.Sig.BoolValue && args.Sig.Number < 17000) { CrestronConsole.PrintLine("Activity: {0}", args.Sig.Number); } }
private void DeviceOnSigChange(BasicTriList currentDevice, SigEventArgs args) { #if DEBUG CrestronConsole.PrintLine("{0}.SigChange ID 0x{1:X2} {2}", currentDevice.GetType().Name, currentDevice.ID, args.Sig.ToString()); #endif OnPanelActivity(this, new UIControllerActivityEventArgs(args.Sig, args.Event)); }
private void DeviceOnSigChange(BasicTriList currentDevice, SigEventArgs args) { if (args.Event != eSigEvent.BoolChange || args.Sig.Number != VisibleJoin.Number || !args.Sig.BoolValue) { return; } CloudLog.Debug("Page Feedback {0} = {1}", args.Sig.Number, args.Sig.BoolValue); }
protected override void panel_SigChange(BasicTriList currentDevice, SigEventArgs args) { //CrestronConsole.PrintLine("panel-SigChange: args.Sig.Ty[e"); if (args.Sig.Type == eSigType.Bool && args.Sig.BoolValue && _closeJoins.Contains(AnalogRelativeJoin(args.Sig.Number))) { Visible = false; OnSubPageClosed(new SubPageClosedEventArgs(AnalogRelativeJoin(args.Sig.Number))); } }
void cde_SigChange(CrestronDeviceWithEvents currentDevice, SigEventArgs args) { if (SigChange != null) { SigChange(this, new UnifiedSigEventArgs(args)); } OnSigChange(args); }
void btl_SigChange(GenericBase currentDevice, SigEventArgs args) { if (SigChange != null) { SigChange(this, new UnifiedSigEventArgs(args)); } OnSigChange(args); }
private void OnSigChange(GenericBase currentDevice, SigEventArgs args) { #if DEBUG Debug.WriteInfo(currentDevice.Name + " OnSigChange()", ", {0}, {1}", args.Event, args.Sig); #endif if (args.Event == eSigEvent.BoolChange) { OnActivity(this); } }
public void tp_SigChange(BasicTriList dev, SigEventArgs args) { var obj = args.Sig.UserObject; if (obj is Action <bool> ) { var func = (Action <bool>)obj; func(args.Sig.BoolValue); } }
protected override void panel_SigChange(BasicTriList currentDevice, SigEventArgs args) { base.panel_SigChange(currentDevice, args); if (args.Sig.Type == eSigType.Bool && _closeJoins.Contains(AnalogRelativeJoin(args.Sig.Number))) { if (_callBack != null) { _callBack.Invoke(this, new SubPageClosedEventArgs(AnalogRelativeJoin(args.Sig.Number))); _callBack = null; } } }
private void PanelSigChange(BasicTriList currentDevice, SigEventArgs args) { if (_device == null) { return; } switch (args.Sig.Type) { case eSigType.Bool: { if (Enum.IsDefined(typeof(PanelDigitalSignals), (int)args.Sig.Number)) { PanelDigitalSignals signalNumber = (PanelDigitalSignals)args.Sig.Number; if (args.Sig.BoolValue) { switch (signalNumber) { case PanelDigitalSignals.ForwardScan: _device.ForwardScan(); break; case PanelDigitalSignals.ForwardSkip: _device.ForwardSkip(); break; case PanelDigitalSignals.Pause: _device.Pause(); break; case PanelDigitalSignals.Play: _device.Play(); break; case PanelDigitalSignals.ReverseScan: _device.ReverseScan(); break; case PanelDigitalSignals.ReverseSkip: _device.ReverseSkip(); break; case PanelDigitalSignals.Stop: _device.Stop(); break; } } } } break; } }
private void OnSigChange(SigEventArgs args) { UnifiedSigEventArgs usea = new UnifiedSigEventArgs(args); switch (args.Event) { case eSigEvent.BoolOutputSigsCleared: BooleanOutput.Where(bo => bo.UserObject is UnifiedSigUserObject && ((UnifiedSigUserObject)bo.UserObject).UnifiedSigEvents != null).Select(bo => ((UnifiedSigUserObject)bo.UserObject).UnifiedSigEvents).ToList().ForEach(lc => lc.FindAll(u => u.SigChange != null && (u.eSigEvent == eSigEvent.NA || u.eSigEvent == eSigEvent.BoolChange)).ForEach(u => u.SigChange(this, usea))); break; case eSigEvent.UShortOutputSigsCleared: UShortOutput.Where(uo => uo.UserObject is UnifiedSigUserObject && ((UnifiedSigUserObject)uo.UserObject).UnifiedSigEvents != null).Select(uo => ((UnifiedSigUserObject)uo.UserObject).UnifiedSigEvents).ToList().ForEach(lc => lc.FindAll(u => u.SigChange != null && (u.eSigEvent == eSigEvent.NA || u.eSigEvent == eSigEvent.UShortChange)).ForEach(u => u.SigChange(this, usea))); break; case eSigEvent.StringOutputSigsCleared: StringOutput.Where(so => so.UserObject is UnifiedSigUserObject && ((UnifiedSigUserObject)so.UserObject).UnifiedSigEvents != null).Select(so => ((UnifiedSigUserObject)so.UserObject).UnifiedSigEvents).ToList().ForEach(lc => lc.FindAll(u => u.SigChange != null && (u.eSigEvent == eSigEvent.NA || u.eSigEvent == eSigEvent.StringChange)).ForEach(u => u.SigChange(this, usea))); break; default: var uuo = args.Sig.UserObject as UnifiedSigUserObject; if (uuo == null) { return; } if (uuo.UnifiedSigEvents == null || uuo.UnifiedSigEvents.Count == 0) { args.Sig.UserObject = uuo.UserObject; return; } switch (args.Sig.Type) { case eSigType.Bool: usea.BoolValue = args.Sig.BoolValue; break; case eSigType.UShort: usea.UShortValue = args.Sig.UShortValue; break; case eSigType.String: usea.StringValue = args.Sig.StringValue; break; } uuo.UnifiedSigEvents.FindAll(u => u.SigChange != null && (u.eSigEvent == eSigEvent.NA || u.eSigEvent == args.Event)).ForEach(u => u.SigChange(this, usea)); break; } }
private void SigChange(BasicTriList dev, SigEventArgs args) { if (args.Sig.Type == eSigType.Bool) { if (args.Sig.BoolValue) { Press(dev, args.Sig.Number); } else { Release(dev, args.Sig.Number); } } }
/// <summary> /// This method is an eventhandler. In this sample, it handles the signal events /// from all touchpanels, and the XPanel. /// This event will not retrigger, until you exit the currently running eventhandler. /// Use threads, or dispatch to a worker, to exit this function quickly. /// </summary> /// <param name="currentDevice">This is the device that is calling this function. /// Use it to identify, for example, which room thebuttom press is associated with.</param> /// <param name="args">This is the signal event argument, it contains all the data you need /// to properly parse the event.</param> void MySigChangeHandler(GenericBase currentDevice, SigEventArgs args) { var sig = args.Sig; var uo = sig.UserObject; CrestronConsole.PrintLine("Event sig: {0}, Type: {1}", sig.Number, sig.GetType()); if (uo is Action <bool> ) // If the userobject for this signal with boolean { (uo as System.Action <bool>)(sig.BoolValue); // cast this signal's userobject as delegate Action<bool> // passing one parm - the value of the bool } else if (uo is Action <ushort> ) { (uo as Action <ushort>)(sig.UShortValue); } else if (uo is Action <string> ) { (uo as Action <string>)(sig.StringValue); } /* * switch (args.Sig.Type) * { * case eSigType.Bool: * { * if (args.Sig.BoolValue) // only process the press, not the release; * { * switch (args.Sig.Number) * { * case 5: * // process boolean press 5 * break; * } * } * if (args.Sig.Type == eSigType.UShort) * { * switch (args.Sig.Number) * { * case 5: * // process number 5 * break; * } * } * break; * } * * } */ }//Event Handler
void myEISC_SigChange(BasicTriList currentDevice, SigEventArgs args) { // What kind of event ?? switch (args.Event) { case eSigEvent.BoolChange: // Bool change event if (args.Sig == myEISC.BooleanOutput[10]) { if (args.Sig.BoolValue == true) { myEISC.StringInput[10].StringValue = "EISC says Turning unit on"; setDisplayPower(true); } else { myEISC.StringInput[10].StringValue = "EISC says Turning unit off"; setDisplayPower(false); } } else if (args.Sig == myEISC.BooleanOutput[11]) { if (args.Sig.BoolValue == true) { myEISC.StringInput[10].StringValue = " EISC says Switching to \"HDMI1\""; setDisplayInput("HDMI1"); } } else if (args.Sig == myEISC.BooleanOutput[12]) { if (args.Sig.BoolValue == true) { myEISC.StringInput[10].StringValue = " EISC says Switching to \"HDMI2\""; setDisplayInput("HDMI2"); } } break; case eSigEvent.StringChange: // String change event break; case eSigEvent.UShortChange: // UShort change event break; } }
void MyXPanSigChangeHandler(BasicTriList currentDevice, SigEventArgs args) { uint button; // join of button press from panel bool push; // button push (true) or release (false) if (args.Sig.Type == eSigType.Bool) // digitals only { button = args.Sig.Number; push = args.Sig.BoolValue; // true is a push, false is a release if ((button >= 1) && (button <= 100)) // Page buttons { Buttons((int)button, push); } } }
/// <summary> /// This method is an eventhandler. In this sample, it handles the signal events /// from the TSW750, TS550, and the XPanel. /// This event will not retrigger, until you exit the currently running eventhandler. /// Use threads, or dispatch to a worker, to exit this function quickly. /// </summary> /// <param name="currentDevice">This is the device that is calling this function. /// Use it to identify, for example, which room thebuttom press is associated with.</param> /// <param name="args">This is the signal event argument, it contains all the data you need /// to properly parse the event.</param> void MySigChangeHandler(GenericBase currentDevice, SigEventArgs args) { switch (args.Sig.Type) { case eSigType.Bool: { if (args.Sig.BoolValue) // only process the press, not the release; { switch (args.Sig.Number) { case 10: { MyCOMPort.Send("!start\n"); break; } case 11: { MyCOMPort.Send("!stop\n"); if (currentDevice == My550 || currentDevice == My750) { ((BasicTriList)currentDevice).BooleanInput[50].BoolValue = true; // send digital value to touchscreen } else { MyXpanel.BooleanInput[50].BoolValue = true; // send digital value to xpanel MyXpanel.BooleanInput[120].BoolValue = false; // send digital value to xpanel } break; } } } if (args.Sig.Type == eSigType.UShort) { switch (args.Sig.Number) { case (15): { MyCOMPort.Send(String.Format("!volume={0}\n", args.Sig.UShortValue)); break; } } } break; } } }
void _tp_SigChange(BasicTriList currentDevice, SigEventArgs args) { if (args.Sig.Type == eSigType.Bool) { // Display controls if (args.Sig.Number > 20 && args.Sig.Number < 30) { _tp_DisplayControl(currentDevice, args.Sig.Number - 20, args.Sig.BoolValue); } // Blu-ray controls if (args.Sig.Number > 30 && args.Sig.Number < 50) { _tp_BluRayControl(currentDevice, args.Sig.Number - 30, args.Sig.BoolValue); } } }
void testPanel_SigChange(BasicTriList currentDevice, SigEventArgs args) { switch (args.Sig.BoolValue) { case true: { if (args.Sig.Number == 1) { RokuRequest("apps"); } break; } default: break; } }
void _tsw_SigChange(BasicTriList currentDevice, SigEventArgs args) { if (args.Sig.Number == 10) { if (args.Sig.BoolValue) { currentDevice.StringInput[1].StringValue = "Hello world!"; } } if (args.Sig.Number == 11) { if (args.Sig.BoolValue) { currentDevice.StringInput[1].StringValue = ""; } } }
void myEISC_SigChange(BasicTriList currentDevice, SigEventArgs args) { switch (args.Sig.Type) { case eSigType.Bool: CrestronConsole.PrintLine("Boolean Received from EISC: {0}, {1}", args.Sig.Number, args.Sig.BoolValue); break; case eSigType.UShort: CrestronConsole.PrintLine("Ushort Received from EISC: {0}, {1}", args.Sig.Number, args.Sig.UShortValue); break; case eSigType.String: CrestronConsole.PrintLine("String Received from EISC: {0}, {1}", args.Sig.Number, args.Sig.StringValue); break; } }
void xp_SigChange(BasicTriList currentDevice, SigEventArgs args) { // determine what type of sig has changed switch (args.Sig.Type) { // a bool (digital) has changed case eSigType.Bool: // determine if the bool sig is true (digital high, press) or false (digital low, release) if (args.Sig.BoolValue) // press { // determine what sig (join) number has chagned switch (args.Sig.Number) { case 1: // call the full off method on the load lampDimmer.DimmingLoads[1].FullOff(); // | | | // | | |- method on this dimmer // | | // | |- array of the actual dimmers on this device // | // |- the crestron device object break; case 2: // call the full on method on the load lampDimmer.DimmingLoads[1].FullOn(); break; case 3: // set the lower value to true (high) which creates a ramp lampDimmer.DimmingLoads[1].Lower.BoolValue = true; break; case 4: // set the raise value to true (high) which creates a ramp lampDimmer.DimmingLoads[1].Raise.BoolValue = true; break; default: break; } } else // release { // determine what sig (join) number has changed switch (args.Sig.Number) { case 3: // sets the lower value to false (low) to stop the ramp lampDimmer.DimmingLoads[1].Lower.BoolValue = false; break; case 4: // sets the raise value to false (low) to stop the ramp lampDimmer.DimmingLoads[1].Raise.BoolValue = false; break; default: break; } } break; // a ushort (analog) has chagned case eSigType.UShort: switch (args.Sig.Number) { case 1: // send the slider value to the lamp dimmer lampDimmer.DimmingLoads[1].Level.UShortValue = args.Sig.UShortValue; break; default: break; } break; case eSigType.String: case eSigType.NA: default: break; } }
/*private void volumeChanged(object sender, EventArgs e) { CrestronConsole.PrintLine("This is called when the event fires."); }*/ void MySigChangeHandler(GenericBase currentDevice, SigEventArgs args) { if (args.Event == eSigEvent.UShortChange) { if (args.Sig.Number < 20) { floorSelect(args.Sig.Number, args.Sig.UShortValue); } if (args.Sig.Number <= 40 && args.Sig.Number > 20) { sendSource(args.Sig.Number, args.Sig.UShortValue); } if (args.Sig.Number == 100) { swampIO(2, args.Sig.UShortValue); }//in, out } if (args.Event == eSigEvent.BoolChange) { if (args.Sig.Number <= 400) { if (args.Sig.BoolValue == true) { zoneSelect(args.Sig.Number); } } else if (args.Sig.Number > 400 && args.Sig.Number <= 440)// Master volume up/dowon { masterVolume(args.Sig.Number, args.Sig.BoolValue); } else if (args.Sig.Number > 440 && args.Sig.Number <= 460 && args.Sig.BoolValue == true) //master mute { mute(args.Sig.Number); } else if (args.Sig.Number > 500 && args.Sig.Number <= 1300) { //individual vol up/down singleVolUpDown(args.Sig.Number, args.Sig.BoolValue); } else if (args.Sig.Number > 1300 && args.Sig.Number <= 1700 && args.Sig.BoolValue == true) {//individual mute mute(args.Sig.Number); } else if (args.Sig.Number > 1700 && args.Sig.Number <= 2100 && args.Sig.BoolValue == true) {//individual off sendOff(args.Sig.Number); } else if (args.Sig.Number > 2100 && args.Sig.Number < 2200 && args.Sig.BoolValue == true) //select / deselect all { selectDeselectAll(args.Sig.Number); } else if (args.Sig.Number > 2200 && args.Sig.Number <= 2220) //group ungroup { groupUngroup(args.Sig.Number, args.Sig.BoolValue); } else if (args.Sig.Number > 2230 && args.Sig.Number < 2235) { //pressHold.presetNum = (ushort)(args.Sig.Number - 2230); //pressAndHold(args.Sig.BoolValue); saveCurrentStatus(args.Sig.Number - 2230); } else if (args.Sig.Number > 2234 && args.Sig.Number < 2238) { if (args.Sig.BoolValue == true) { recallPartyMode(args.Sig.Number - 2234); } } else if (args.Sig.Number > 2250 && args.Sig.Number < 2300) { onMusicMenu(args.Sig.Number, args.Sig.BoolValue);//THIS NEEDS UPDATING!!!!!!! } else if (args.Sig.Number > 2300 && args.Sig.Number < 2700) { pressAndHold(args.Sig.Number, args.Sig.BoolValue); } } }
/// This method is an eventhandler. void MySigChangeHandler(GenericBase currentDevice, SigEventArgs args) { var sig = args.Sig; var uo = sig.UserObject; CrestronConsole.PrintLine("Event sig: {0}, Type: {1}", sig.Number, sig.GetType()); if (uo is Action<bool>) // If the userobject for this signal with boolean { (uo as System.Action<bool>)(sig.BoolValue); // cast this signal's userobject as delegate Action<bool> // passing one parm - the value of the bool } else if (uo is Action<ushort>) { (uo as Action<ushort>)(sig.UShortValue); } else if (uo is Action<string>) { (uo as Action<string>)(sig.StringValue); } }
/// <summary> /// Method to handle sig change (joins) events. /// </summary> /// <param name="currentDevice">Reference to the device raising this event.</param> /// <param name="args">Information about the event being raised.</param> void xPanelUi_SigChange(BasicTriList currentDevice, SigEventArgs args) { switch (args.Sig.Type) { case eSigType.Bool: if (args.Sig.BoolValue == true) { // press event } else { // release event switch (args.Sig.Number) { case (uint)eXpanelButtons.TimeoutPress: SetNewTimeoutValue(xPanelUi.UShortOutput[(uint)eXpanelFeedbacks.UShortTimeout].UShortValue * 1000); break; case (uint)eXpanelButtons.ShowScalerPage: xPanelUi.BooleanInput[(uint)eXpanelFeedbacks.BoolShowScalerPage].BoolValue = true; break; case (uint)eXpanelButtons.ClearScalerSubpage: xPanelUi.BooleanInput[(uint)eXpanelFeedbacks.BoolShowScalerPage].BoolValue = false; break; default: break; } } break; case eSigType.String: break; case eSigType.UShort: break; case eSigType.NA: default: break; } }
/// <summary> /// This method is an eventhandler. In this sample, it handles the signal events /// from all touchpanels, and the XPanel. /// This event will not retrigger, until you exit the currently running eventhandler. /// Use threads, or dispatch to a worker, to exit this function quickly. /// </summary> /// <param name="currentDevice">This is the device that is calling this function. /// Use it to identify, for example, which room thebuttom press is associated with.</param> /// <param name="args">This is the signal event argument, it contains all the data you need /// to properly parse the event.</param> void MySigChangeHandler(GenericBase currentDevice, SigEventArgs args) { var sig = args.Sig; var uo = sig.UserObject; CrestronConsole.PrintLine("Event sig: {0}, Type: {1}", sig.Number, sig.GetType()); if (uo is Action<bool>) // If the userobject for this signal with boolean { (uo as System.Action<bool>)(sig.BoolValue); // cast this signal's userobject as delegate Action<bool> // passing one parm - the value of the bool } else if (uo is Action<ushort>) { (uo as Action<ushort>)(sig.UShortValue); } else if (uo is Action<string>) { (uo as Action<string>)(sig.StringValue); } /* switch (args.Sig.Type) { case eSigType.Bool: { if (args.Sig.BoolValue) // only process the press, not the release; { switch (args.Sig.Number) { case 5: // process boolean press 5 break; } } if (args.Sig.Type == eSigType.UShort) { switch (args.Sig.Number) { case 5: // process number 5 break; } } break; } } */ }
} // Event Handler // Event Handler for UIs - touchpanels etc. void MySigChangeHandler(GenericBase currentDevice, SigEventArgs args) { var sig = args.Sig; var uo = sig.UserObject; }//Event Handler