void SmartObject_BtnList_SigChange(BasicTriListWithSmartObject currentDevice, SmartObjectEventArgs args) { SmartObject so = currentDevice.SmartObjects[args.SmartObjectArgs.ID]; SmartObject soDynBtnList = currentDevice.SmartObjects[SG_DYNAMIC_BTN_LIST]; SmartObject soDynIconList = currentDevice.SmartObjects[SG_DYNAMIC_ICON_LIST]; Sig sig = args.Sig; switch (sig.Type) { case eSigType.Bool: if (sig.BoolValue) { OnDebug(eDebugEventType.Info, "Press event"); switch (sig.Number) { //case 1: break; default: //SG.ToggleSmartObjectVisible(soDynBtnList , (int)sig.Number); // toggle visibility //SG.ToggleSmartObjectVisible(soDynIconList, (int)sig.Number); // toggle visibility // toggle the button feedback and put some text onto it string buttonText = "Item " + sig.Number.ToString(); SG.ToggleSmartObjectSelected(so, (int)sig.Number); // standard button lists don't support feedback so this doesn't do anything SG.SetSmartObjectText(so, (int)sig.Number, buttonText); // soDynBtnList uses dynamic IconAnalogs, of type MediaTransports SG.ToggleSmartObjectVisible(soDynBtnList, (int)sig.Number); // toggle visibility SG.SetSmartObjectEnabled(soDynBtnList, (int)sig.Number, true); // enable SG.SetSmartObjectIconAnalog(soDynBtnList, (int)sig.Number, (ushort)sig.Number); // set icon to the next analog // soDynIconList uses dynamic IconSerials, of type IconsLg SG.ToggleSmartObjectVisible(soDynIconList, (int)sig.Number); // toggle visibility SG.SetSmartObjectEnabled(soDynIconList, (int)sig.Number, true); // enable string icon = UI.IconsLgDict[0]; SG.SetSmartObjectIconSerial(soDynIconList, (int)sig.Number, icon); // set icon to the next serial break; } } else { OnDebug(eDebugEventType.Info, "Release event"); } break; case eSigType.UShort: OnDebug(eDebugEventType.Info, "UShortValue: {0}", sig.UShortValue.ToString()); break; case eSigType.String: OnDebug(eDebugEventType.Info, "StringValue: {0}", sig.StringValue); break; default: OnDebug(eDebugEventType.Info, "Unhandled sig type: {0}", sig.Type.ToString()); break; } }
void SmartObject_DynIconList_SigChange(BasicTriListWithSmartObject currentDevice, SmartObjectEventArgs args) { SmartObject so = currentDevice.SmartObjects[args.SmartObjectArgs.ID]; SmartObject soBtnList = currentDevice.SmartObjects[SG_BTN_LIST]; SmartObject soDynBtnList = currentDevice.SmartObjects[SG_DYNAMIC_BTN_LIST]; Sig sig = args.Sig; switch (sig.Type) { case eSigType.Bool: if (sig.BoolValue) { OnDebug(eDebugEventType.Info, "Press event"); switch (sig.Number) { default: int number = StringHelper.Atoi(sig.Name); // Number is offset by 10 so we need item with no offset // toggle the button feedback and put some text onto it // SG.ToggleSmartObjectDigitalJoin(so, (int)sig.Number); string buttonText = "Item " + sig.Number.ToString() + " " + SG.GetSmartObjectDigitalJoin(so, (int)sig.Number).ToString(); //SG.SetSmartObjectText (so, (int)sig.Number, buttonText); // SG.SetSmartObjectText (so, number, buttonText); string icon = UI.IconsLgDict[(ushort)number]; SG.SetSmartObjectIconSerial(so, number, icon); // set icon to the next serial //SG.ToggleSmartObjectEnabled(soDynBtnList, number); // enable //SG.ToggleSmartObjectDigitalJoin(soBtnList, number); //SG.SetSmartObjectText (soBtnList, number, buttonText); break; } } else { OnDebug(eDebugEventType.Info, "Release event"); } break; case eSigType.UShort: OnDebug(eDebugEventType.Info, "UShortValue: {0}", sig.UShortValue.ToString()); break; case eSigType.String: OnDebug(eDebugEventType.Info, "StringValue: {0}", sig.StringValue); break; default: OnDebug(eDebugEventType.Info, "Unhandled sig type: {0}", sig.Type.ToString()); break; } }