Ejemplo n.º 1
0
 // Action was triggered, handle it
 private void OnAction(string actionKey, InputDigitalActionData_t data, ulong inputSourceHandle)
 {
     KeyActivatedAction.Invoke(actionKey, data.bState);
     Debug.WriteLine($"{actionKey} : " + (data.bState ? "PRESSED" : "RELEASED"));
     if (MainModel.BindingExists(actionKey))
     {
         var binding = MainModel.GetBinding(actionKey);
         if (data.bState)
         {
             if (MainModel.LoadSetting(MainModel.Setting.Haptic))
             {
                 if (inputSourceHandle == _inputSourceHandleLeft)
                 {
                     _ovr.TriggerHapticPulseInController(ETrackedControllerRole.LeftHand);
                 }
                 if (inputSourceHandle == _inputSourceHandleRight)
                 {
                     _ovr.TriggerHapticPulseInController(ETrackedControllerRole.RightHand);
                 }
             }
             if (MainModel.LoadSetting(MainModel.Setting.Notification))
             {
                 var notificationBitmap = EasyOpenVRSingleton.BitmapUtils.NotificationBitmapFromBitmap(Properties.Resources.logo);
                 _ovr.EnqueueNotification(_notificationOverlayHandle, $"{actionKey} simulated {GetKeysLabel(binding.Item1)}", notificationBitmap);
             }
         }
         SimulateKeyPress(data, binding);
     }
 }
Ejemplo n.º 2
0
        public void Init(string[] actionKeys)
        {
            _actionKeys = actionKeys;

            // Sets default values for status labels
            StatusUpdateAction.Invoke(false);
            AppUpdateAction.Invoke(MainModel.CONFIG_DEFAULT);
            KeyActivatedAction.Invoke(string.Empty, false);

            // Loads default config
            LoadConfig(true);

            // Start background thread
            var workerThread = new Thread(WorkerThread);

            workerThread.Start();
        }