private void SendGenericCommand(SET_EVENT sendingEvent, uint dwData)
 {
     try
     {
         simconnect?.TransmitClientEvent(SimConnect.SIMCONNECT_OBJECT_ID_USER, sendingEvent, dwData, GROUPID.MAX, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY);
     }
     catch (COMException ex) when(ex.Message == "0xC00000B0")
     {
         RecoverFromError(ex);
     }
 }
        public void RegisterSetEvent(SET_EVENT action)
        {
            if (simconnect == null)
            {
                return;
            }

            if (setEvents.Contains(action))
            {
                logger.LogInformation("Already registered: {action}", action);
                return;
            }

            setEvents.Add(action);
            logger.LogInformation("RegisterEvent {action} {simConnectAction}", action, action.ToString());
            simconnect.MapClientEventToSimEvent(action, action.ToString());
        }
 public void Set(SET_EVENT action, uint data)
 {
     logger.LogInformation("Set {action} to {data}", action, data);
     SendGenericCommand(action, data);
 }