Is it possible to add a custom door icon in access control?
I’d like an icon displayed when in LockDown state.
// Should I somehow add a custom icon here?
internal static ACStateType[] DoorStateTypes
{
get
{
return new ACStateType[]
{
new ACStateType(DoorStatusId.PhysicalStateOpen, StringResources.State_DoorPhysicalStateOpen, ACBuiltInIconKeys.DoorOpen, Properties.Empty, new string[]{ ACBuiltInStateTypeCategories.DoorStateOpen }),
new ACStateType(DoorStatusId.PhysicalStateClosed, StringResources.State_DoorPhysicalStateClosed, ACBuiltInIconKeys.DoorClosed, Properties.Empty, new string[]{ ACBuiltInStateTypeCategories.DoorStateClosed }),
new ACStateType(DoorStatusId.ModeLocked, StringResources.State_DoorModeLocked, ACBuiltInIconKeys.DoorClosedLocked, Properties.Empty, new string[]{ ACBuiltInStateTypeCategories.DoorStateLocked }),
new ACStateType(DoorStatusId.ModeUnlocked, StringResources.State_DoorModeUnlocked, ACBuiltInIconKeys.DoorClosedUnlocked, Properties.Empty, new string[]{ ACBuiltInStateTypeCategories.DoorStateUnlocked }),
new ACStateType(DoorStatusId.AlarmStateForcedOpen, StringResources.State_DoorAlarmStateForcedOpen, ACBuiltInIconKeys.DoorError, Properties.Empty, Categories.Empty),
new ACStateType(DoorStatusId.AlarmStateOpenTooLong, StringResources.State_DoorAlarmStateOpenTooLong, ACBuiltInIconKeys.DoorError, Properties.Empty, Categories.Empty),
new ACStateType(DoorStatusId.WarningStateOpenTooLong, StringResources.State_DoorAlarmStateOpenTooLong, ACBuiltInIconKeys.DoorError, Properties.Empty, Categories.Empty),
};
}
}
On the ACPlugin class there is a method called GetIcons which should be implemented to return a list of icons along with their keys. The keys can then be used in the ACStateType definition.
Bo, Your answer may have been a good starting point.
But when I use this ACState() mentioned here, I get a grey door. What might need to be different??
new ACState(doorId, new List { DoorStatusId.InLockdown }, DoorStatusId.ModeLockdown, null);
VideoOS.Platform.AccessControl.Plugin.ACState.
ACState(
string operationableInstanceId,
IEnumerable<string> stateTypeIds,
string iconKey, // [_]?: WILL THIS HANDLE CUSTOM ICONS?
IEnumerable<ACProperty> properties
)
=== WORKS WITH BUILT IN ICON.
new ACState(doorId, new List<string> { DoorStatusId.PhysicalStateClosed, DoorStatusId.ModeLocked }, ACBuiltInIconKeys.DoorClosedLocked, null);
=== NOT YET WORKING WITH CUSTOM ICON.
new ACState(doorId, new List<string> { DoorStatusId.InLockdown }, DoorStatusId.ModeLockdown, null);
=== MY CUSTOM ICON:
public ACConfiguration FetchConfigWorker(bool returnACConfigEarly)
{
Plugin.MXPBridgePlugin._icons.Add(new ACIconInfo(DoorStatusId.InLockdown, global::MXPB_ACM.Properties.Resources.lock_24_512));
...
}
The "=== NOT YET WORKIING.. " part seems wrong to me, seems to me you have StatusID where there should be an Icon.
I hope this is a hint, let me know if it leads anywhere.
I knew about needing an IconKey there, but was uncertain of what all was needed/required to get to that point.
SOLUTION: I needed to place this code into a different function. That’s all it took.
Plugin.MXPBridgePlugin._icons.Add(
new ACIconInfo(CustomIconKeys.LckDnDoorClosed,
global::MXPB_ACM.Properties.Resources.LockDownClosed_02)
);