コード例 #1
0
        private void KeyHandler(KeyboardAction action, KeyboardKey key)
        {
            //Console.WriteLine($"TestKeyEvents.KeyHandler({action}, {key})");
            if (action == KeyboardAction.KeyRelease)
            {
                switch (key)
                {
                case KeyboardKey.Num_1:
                    window.SetClearColor(128, 52, 43);
                    break;

                case KeyboardKey.Num_2:
                    window.SetClearColor(28, 108, 218);
                    break;

                case KeyboardKey.F1:
                    f1Pressed = true;
                    break;

                case KeyboardKey.Escape:
                    window.CloseWindow();
                    break;
                }
            }
        }
コード例 #2
0
        private void KeyHandler(KeyboardAction action, KeyboardKey key)
        {
            if (action == KeyboardAction.KeyRelease)
            {
                switch (key)
                {
                case KeyboardKey.Num_1:
                    window.SetClearColor(128, 52, 43);
                    break;

                case KeyboardKey.Num_2:
                    window.SetClearColor(28, 108, 218);
                    break;

                case KeyboardKey.T:
                    AddTimedEvent();
                    break;

                case KeyboardKey.Y:
                    AddTimedEvent((uint)random.Next());
                    break;

                case KeyboardKey.Escape:
                    window.CloseWindow();
                    break;
                }
            }
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: temach/skeletal-animation
        /// <summary>
        /// Intercept arrow keys to send input to the picture box.
        /// (for the active control to see the keypress, return false)
        /// </summary>
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            KeyboardAction action = _kbd.ProcessKeydown(keyData);

            if (action == KeyboardAction.DoRotation)
            {
                Vector3 rotation_axis = _kbd.GetRotationAxis(_kbd.RecentKey);
                _camera.RotateAround(rotation_axis);
                return(true);
            }
            else if (action == KeyboardAction.DoMotion)
            {
                Vector3 direction = _kbd.GetDirectionNormalized(_kbd.RecentKey);
                _camera.MoveBy(direction);
                this.toolStripStatusLabel_camera_position.Text = _camera.GetTranslation.ToString();
                return(true); // hide this key event from other controls
            }
            else if (action == KeyboardAction.RunCommand)
            {
                // _cmd.RunCmd(this.textBox_cli.Text);
                return(true);
            }
            else if (action == KeyboardAction.None)
            {
                return(base.ProcessCmdKey(ref msg, keyData));
            }
            Debug.Assert(false, "You forgot to handle some keyboard action");
            return(false);
        }
コード例 #4
0
        public static string EndShowKeyboardInput(IAsyncResult result)
        {
            string text = keyboardAction.TextInput;

            keyboardAction = null;
            return(text);
        }
コード例 #5
0
    public void getMenuItem()
    {
        FocusedObject = hitInfo.collider.gameObject;


        if (FocusedObject == GameObject.Find("Front"))
        {
            keyboard = new KeyboardAction();
            keyboard.OnSelect();
        }

        if (FocusedObject == GameObject.Find("Left"))
        {
            bookmark = new RegisterBookmark();
            bookmark.OnSelect();
        }
        if (FocusedObject == GameObject.Find("Right"))
        {
            plus = new PlusAction();
            plus.OnSelect();
        }

        else
        {
            manipulating = false;
        }
    }
コード例 #6
0
        public Task UpdateKeyboardAction(KeyboardAction keyboardAction)
        {
            //one shortcut per action, so only updates
            var connection = new SQLiteAsyncConnection(DbPath);

            return(connection.UpdateAsync(keyboardAction));
        }
コード例 #7
0
        protected override void OnProcess(Action.IAction action)
        {
            KeyboardAction keyboardAction = action as KeyboardAction;

            if (keyboardAction == null)
            {
                return;
            }

            LoggerManager.Debug(action.AutomationActionData);

            HtmlElement element = this.GetData(action) as HtmlElement;

            if (element == null)
            {
                LoggerManager.Error("Element Not Found");
                throw new ElementNoFoundException("Element Not Found", action);
            }

            if (keyboardAction.KeyDown)
            {
                this.Call <HtmlElement>(Down, element);
            }

            if (keyboardAction.KeyUp)
            {
                this.Call <HtmlElement>(Up, element);
            }
        }
コード例 #8
0
ファイル: InputArgs.cs プロジェクト: VilRan/Legatus
 public KeyboardEventArgs(KeyboardAction action, Keys key, Keys[] heldKeys, GameTime gameTime)
 {
     Action   = action;
     Key      = key;
     HeldKeys = heldKeys;
     GameTime = gameTime;
 }
コード例 #9
0
        private static void KeyHandler(KeyboardAction action, KeyboardKey key)
        {
            //Console.WriteLine($"TestKeyEvents.KeyHandler({action}, {key})");
            if (action == KeyboardAction.KeyRelease)
            {
                switch (key)
                {
                case KeyboardKey.Num_1:
                    window.SetClearColor(128, 52, 43);
                    break;

                case KeyboardKey.Num_2:
                    window.SetClearColor(28, 108, 218);
                    break;

                case KeyboardKey.I:
                    var n = ran.Next();
                    test.Add(n, $"insert({n})");
                    break;

                case KeyboardKey.Escape:
                    window.CloseWindow();
                    break;
                }
            }
        }
コード例 #10
0
        /// <summary>
        /// Map a key with an action.
        /// </summary>
        /// <param name="key">The key pressed.</param>
        /// <param name="modifierKeys">The modifier keys pressed.</param>
        /// <param name="keyboardAction">The keyboard action.</param>
        /// <param name="keyboardActionContext">The keyboard action context.</param>
        public void Map(Key key, ModifierKeys modifierKeys, KeyboardAction keyboardAction, KeyboardActionContext keyboardActionContext)
        {
            Tuple <Key, ModifierKeys, KeyboardActionContext> tuple = new Tuple <Key, ModifierKeys, KeyboardActionContext>(key, modifierKeys, keyboardActionContext);

            if (!this.Mappings.ContainsKey(tuple))
            {
                this.Mappings.Add(tuple, keyboardAction);
            }
        }
コード例 #11
0
        private static System.Action GetAction(int taskID, ActionModel action)
        {
            IAction actionInstance = null;

            switch (action.Action)
            {
            case ActionType.WriteFile:
                actionInstance = new WriteFileAction();
                break;

            case ActionType.IF:
                actionInstance = new IFAction();
                break;

            case ActionType.HttpRequest:
                actionInstance = new HttpRequestAction();
                break;

            case ActionType.Shutdown:
                actionInstance = new ShutdownAction();
                break;

            case ActionType.StartProcess:
                actionInstance = new StartProcessAction();
                break;

            case ActionType.OpenURL:
                actionInstance = new OpenURLAction();
                break;

            case ActionType.Snipping:
                actionInstance = new SnippingAction();
                break;

            case ActionType.DeleteFile:
                actionInstance = new DeleteFileAction();
                break;

            case ActionType.SoundPlay:
                actionInstance = new SoundPlayAction();
                break;

            case ActionType.GetIPAddress:
                actionInstance = new GetIPAddressAction();
                break;

            case ActionType.Keyboard:
                actionInstance = new KeyboardAction();
                break;
            }
            if (actionInstance != null)
            {
                return(actionInstance.GenerateAction(taskID, action));
            }
            return(null);
        }
コード例 #12
0
        public PlayerControls()
        {
            this.rotateClockwise        = KeyboardAction.FromKey(Key.Right);
            this.rotateCounterClockwise = KeyboardAction.FromKey(Key.Left);
            this.shoot   = KeyboardAction.FromKey(Key.Space);
            this.zoomIn  = KeyboardAction.FromKey(Key.PageDown);
            this.zoomOut = KeyboardAction.FromKey(Key.PageUp);

            this.shootDebug = KeyboardAction.FromKey(Key.P);
        }
コード例 #13
0
        /// <summary>
        /// Called when a key is pressed or released.
        /// </summary>
        /// <param name="code">A code the hook procedure uses to determine how to process the message. If code is less than zero, the hook procedure must pass the message to the CallNextHookEx function without further processing and should return the value returned by CallNextHookEx.</param>
        /// <param name="wParam">The virtual-key code of the key that generated the keystroke message.</param>
        /// <param name="lParam">The repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag. For more information about the lParam parameter, see Keystroke Message Flags.</param>
        /// <returns>If code is less than zero, the hook procedure must return the value returned by CallNextHookEx.</returns>
        private IntPtr KeyboardHookProc(int code, IntPtr wParam, IntPtr lParam)
        {
            if (code < 0)
            {
                return(NativeMethods.CallNextHookEx(_keyboardHookHandle, code, wParam, lParam));
            }

            var vKey = Marshal.ReadInt32(lParam);
            var key  = KeyInterop.KeyFromVirtualKey(vKey);

            var keyState = KeyState.Unknown;

            if ((int)wParam == 256 || (int)wParam == 260)
            {
                keyState = KeyState.Pressed;
            }
            else if ((int)wParam == 257)
            {
                keyState = KeyState.Released;
            }

            // Get capslock and shifts states, and determine whether the key is uppercase or not
            var capslockState = Convert.ToBoolean(NativeMethods.GetKeyState(0x14));
            var lShiftState   = Convert.ToBoolean(NativeMethods.GetKeyState(0xA0) >> 1);
            var rShiftState   = Convert.ToBoolean(NativeMethods.GetKeyState(0xA1) >> 1);

            if (rShiftState || lShiftState)
            {
                capslockState = !capslockState;
            }

            if (IsActionAllowed(keyState))
            {
                var eventArgs = new KeyboardHookEventArgs(key, keyState, capslockState, DateTime.Now.Ticks);

                AddEventToHistory(eventArgs);

                KeyboardAction?.Invoke(this, eventArgs);

                if (eventArgs.Handled)
                {
                    return((IntPtr)1);
                }
            }

            return(NativeMethods.CallNextHookEx(_keyboardHookHandle, code, wParam, lParam));
        }
コード例 #14
0
        private IntPtr LLKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam)
        {
            KeyboardActionEventArgs eventArgs = new KeyboardActionEventArgs {
                IsCancelled = false
            };

            if (nCode >= 0)
            {
                eventArgs.Action = (KeyboardAction)wParam.ToInt32();
                eventArgs.Data   = Marshal.PtrToStructure <KeyboardEventData>(lParam);
                try
                {
                    KeyboardAction?.Invoke(this, eventArgs);
                } catch { }
            }
            return(eventArgs.IsCancelled ? (IntPtr)1 : CallNextHookEx(m_hhook, nCode, wParam, lParam));
        }
コード例 #15
0
 public static Offset <PlayerMovement> CreatePlayerMovement(FlatBufferBuilder builder,
                                                            uint objectId           = 0,
                                                            KeyboardAction keyUp    = 0,
                                                            KeyboardAction keyDown  = 0,
                                                            KeyboardAction keyLeft  = 0,
                                                            KeyboardAction keyRight = 0,
                                                            int direction           = 0)
 {
     builder.StartObject(6);
     PlayerMovement.AddDirection(builder, direction);
     PlayerMovement.AddObjectId(builder, objectId);
     PlayerMovement.AddKeyRight(builder, keyRight);
     PlayerMovement.AddKeyLeft(builder, keyLeft);
     PlayerMovement.AddKeyDown(builder, keyDown);
     PlayerMovement.AddKeyUp(builder, keyUp);
     return(PlayerMovement.EndPlayerMovement(builder));
 }
コード例 #16
0
        public void RemoveKeyboardAction(Keys key, bool shift, bool control, bool alt)
        {
            int i = KeyboardActions.Count - 1;

            while (i >= 0)
            {
                KeyboardAction ka = KeyboardActions[i];

                if (ka.Key == key &&
                    ka.Alt == alt &&
                    ka.Shift == shift &&
                    ka.Control == control)
                {
                    KeyboardActions.Remove(ka);
                }

                i--;
            }
        }
コード例 #17
0
 public static IAsyncResult BeginShowKeyboardInput(
     PlayerIndex player,
     string title,
     string description,
     string defaultText,
     AsyncCallback callback,
     object state,
     bool usePasswordMode
     )
 {
     SteamUtils.ShowGamepadTextInput(
         usePasswordMode ?
         EGamepadTextInputMode.k_EGamepadTextInputModePassword :
         EGamepadTextInputMode.k_EGamepadTextInputModeNormal,
         EGamepadTextInputLineMode.k_EGamepadTextInputLineModeSingleLine,
         title + ": " + description,
         4096,                 // FIXME
         defaultText
         );
     keyboardAction = new KeyboardAction(state, callback, defaultText);
     return(keyboardAction);
 }
コード例 #18
0
        private void OnKeyboardAction(object sender, KeyboardHookEventArgs e)
        {
            KeyboardAction?.Invoke(this, e);

            // Add or remove key from clicked keys list
            switch (e.State)
            {
            case KeyState.Pressed:
                _clickedKeys.RemoveAll(p => p.Item2 == e.Key);
                _clickedKeys.Add(new Tuple <DateTime, Key>(DateTime.Now, e.Key));
                break;

            case KeyState.Released:
                _clickedKeys.RemoveAll(p => p.Item2 == e.Key);
                break;
            }

            // Remove old key that has not been removed correctly.
            _clickedKeys.RemoveAll(p => (DateTime.Now - p.Item1).TotalSeconds > 3);

            // Init list of called hot keys
            var checkedHotKeys = DetectHotKeys();

            for (var i = 0; i < checkedHotKeys.Count; i++)
            {
                var eventArgs = new HotKeyEventArgs(checkedHotKeys[i].Name, checkedHotKeys[i].Keys, DateTime.Now.Ticks);

                AddEventToHistory(eventArgs);
                _clickedKeys.Clear();

                // Call OnHotKeyAction event with specific name and list of keys
                Logger.Instance.Information($"Keyboard shortcut detected by {nameof(MouseAndKeyboardHookService)}.");
                HotKeyDetected?.Invoke(this, eventArgs);

                e.Handled = eventArgs.Handled;
            }
        }
コード例 #19
0
        protected virtual void ExecuteAction(KeyEventArgs e)
        {
            var window = this.windowManager.GetWindowWithFocus();

            if (window == null)
            {
                // no window has focus => no localized command should be executed.
                return;
            }

            var view = window.Content as FrameworkElement;

            if (view == null)
            {
                return;
            }

            var viewModel = view.DataContext as IKeyboardAware;

            KeyboardActionContext c;

            if (viewModel == null || viewModel.ActionContext != (c = this.GetKeyboardActionContext()))
            {
                return;
            }

            KeyboardAction keyboardAction = this.keyboardManagerService.GetKeyboardAction(e.Key, Keyboard.Modifiers, viewModel.ActionContext);

            Tuple <KeyboardAction, object> tuple = new Tuple <KeyboardAction, object>(keyboardAction, this.GetCommandParameter());

            if ((keyboardAction == KeyboardAction.ActivateModel || this.CanHandleKey(e)) && keyboardAction != KeyboardAction.None && this.Command != null && this.Command.CanExecute(tuple))
            {
                this.Command.Execute(tuple);

                e.Handled = true;
            }
        }
コード例 #20
0
        /// <summary>
        /// Handles the key down commands.
        /// </summary>
        /// <param name="keyboardAction">The keyboard action to execute.</param>
        public void HandleKeyboardAction(KeyboardAction keyboardAction)
        {
            switch (keyboardAction)
            {
            case KeyboardAction.Rewind:
                if (this.action == KeyboardAction.Rewind)
                {
                    this.OnFrameRewindEnded();
                    this.action = null;
                }
                else
                {
                    this.OnFrameRewindStarted();
                    this.action = KeyboardAction.Rewind;
                }

                break;

            case KeyboardAction.Forward:
                if (this.action == KeyboardAction.Forward)
                {
                    this.OnFrameForwardEnded();
                    this.action = null;
                }
                else
                {
                    this.OnFrameForwardStarted();
                    this.action = KeyboardAction.Forward;
                }

                break;

            case KeyboardAction.FullScreen:
                this.OnFullScreenChanged(FullScreenMode.Player);
                break;
            }
        }
コード例 #21
0
ファイル: EconomyController.cs プロジェクト: tdav/syzygy
        public EconomyController(GameState game, Id <Player> player, PlayerGameView view)
            : base(game)
        {
            this.view    = view;
            this.player  = game.Players[player];
            this.economy = game.Economies.First(e => e.Player == this.player);
            this.body    = this.economy.Body;

            view.FocusOnBody(this.body);

            this.controls = new PlayerControls();

            this.stats = new[]
            {
                new EcoStatController(this.game, this, this.economy, EcoValue.Income,
                                      KeyboardAction.FromKey(Key.Number1), KeyboardAction.FromKey(Key.Number2), "1<>2"),
                new EcoStatController(this.game, this, this.economy, EcoValue.Projectiles,
                                      KeyboardAction.FromKey(Key.Q), KeyboardAction.FromKey(Key.W), "Q<>W"),
                new EcoStatController(this.game, this, this.economy, EcoValue.FireRate,
                                      KeyboardAction.FromKey(Key.A), KeyboardAction.FromKey(Key.S), "A<>S"),
                new EcoStatController(this.game, this, this.economy, EcoValue.Defenses,
                                      KeyboardAction.FromKey(Key.Z), KeyboardAction.FromKey(Key.X), "Z<>X"),
            };
        }
コード例 #22
0
            internal bool TryParseLowerTrimmedString(string value, out IAction action)
            {
                action = null;

                if (!value.StartsWith("keyboard:"))
                {
                    return(false);
                }

                var keyName = value.Substring(9).Trim();

                if (!Enum.TryParse(keyName, false, out Key key))
                {
                    return(false);
                }

                if (key == Key.Unknown)
                {
                    return(false);
                }

                action = new KeyboardAction(manager, key);
                return(true);
            }
コード例 #23
0
 public static INode FromAction(this IAction action)
 {
     return(action switch {
         DelayAction delayAction => throw new NotImplementedException(),
         KeyboardAction keyboardAction => new KeyboardNode(new KeyboardNodeViewModel {
             Keys = new AvaloniaList <byte>(keyboardAction.Keys),
             DelayAfter = keyboardAction.DelayAfter,
             DelayBefore = keyboardAction.DelayBefore,
             InputType = keyboardAction.InputType,
         }),
         MouseAction mouseAction => new MouseNode(new MouseNodeViewModel {
             Key = mouseAction.Key,
             DelayAfter = mouseAction.DelayAfter,
             DelayBefore = mouseAction.DelayBefore,
             InputType = mouseAction.InputType,
         }),
         MouseMoveAction mouseMoveAction => new MouseMoveNode(new MouseMoveNodeViewModel {
             DelayAfter = mouseMoveAction.DelayAfter,
             DelayBefore = mouseMoveAction.DelayBefore,
             Horizontal = mouseMoveAction.Horizontal,
             Vertical = mouseMoveAction.Vertical,
             MouseMoveType = mouseMoveAction.MouseMoveType,
         }),
         RepeatAction repeatAction => new RepeatNode(new RepeatNodeViewModel {
             DelayAfter = repeatAction.DelayAfter,
             DelayBefore = repeatAction.DelayBefore,
             RepeatCount = repeatAction.RepeatCount,
             SelectedNode = repeatAction.Action?.FromAction(),
         }),
         TextAction textAction => new TextNode(new TextNodeViewModel {
             Text = textAction.Text,
             DelayAfter = textAction.DelayAfter,
             DelayBefore = textAction.DelayBefore,
         }),
         _ => throw new ArgumentOutOfRangeException(nameof(action)),
     });
コード例 #24
0
 /// <summary>
 /// Returns a sequence of all currently valid actions, including all keyboard keys, as well as all controls for all connected gamepads.
 /// </summary>
 public static IEnumerable <IAction> GetAllAvailable()
 {
     return(KeyboardAction.GetAll().Concat(InputManager.GamePads.SelectMany(GamePadAction.GetAll)));
 }
コード例 #25
0
 public DeactivateActionProcessor(SpeechProcessor speechProcessor, CursorLoopProcessor cursorLoopProcessor)
 {
     this.cursorLoopProcessor = cursorLoopProcessor;
     this.speechProcessor = speechProcessor;
     this.deactivateAction = new DeactivateAction();
 }
コード例 #26
0
        void DoKeyboardAction(KeyboardAction keyboardAction)
        {
            // determine if it's a combination of keys or not

            if (virtualKeys[1] == VirtualKey.None && virtualKeys[2] == VirtualKey.None)
            {
                // this is a simple shortcut
                switch (keyboardAction.Action)
                {
                case VLCAction.FullscreenToggle:
                    AppViewHelper.ToggleFullscreen();
                    break;

                case VLCAction.LeaveFullscreen:
                    AppViewHelper.LeaveFullscreen();
                    break;

                case VLCAction.PauseToggle:
                    Locator.MediaPlaybackViewModel.PlaybackService.Pause();
                    break;

                case VLCAction.Quit:
                    App.Current.Exit();
                    break;

                case VLCAction.Stop:
                    if (Locator.MediaPlaybackViewModel.PlaybackService.PlayingType == PlayingType.Video)
                    {
                        Locator.MediaPlaybackViewModel.GoBack.Execute(null);
                    }
                    break;

                case VLCAction.Previous:
                    Locator.PlaybackService.Previous();
                    break;

                case VLCAction.Next:
                    Locator.PlaybackService.Next();
                    break;

                case VLCAction.Faster:
                    Locator.MediaPlaybackViewModel.ChangePlaybackSpeedRateCommand.Execute("faster");
                    break;

                case VLCAction.Slow:
                    Locator.MediaPlaybackViewModel.ChangePlaybackSpeedRateCommand.Execute("slower");
                    break;

                case VLCAction.NormalRate:
                    Locator.MediaPlaybackViewModel.ChangePlaybackSpeedRateCommand.Execute("reset");
                    break;

                case VLCAction.Mute:
                    Locator.MediaPlaybackViewModel.ChangeVolumeCommand.Execute("mute");
                    break;

                case VLCAction.Back:
                    Locator.NavigationService.GoBack_Specific();
                    break;
                }
            }
            else if (virtualKeys[2] == VirtualKey.None)
            {
                // two keys shortcut
                if (virtualKeys[0] == VirtualKey.Control && virtualKeys[1] == keyboardAction.SecondKey)
                {
                    //two keys shortcut, first key is Ctrl
                    switch (keyboardAction.Action)
                    {
                    case VLCAction.OpenFile:
                    {
                        Locator.MediaPlaybackViewModel.PickMediaCommand.Execute(null);
                    }
                    break;

                    case VLCAction.OpenNetwork:
                    {
                        Locator.MainVM.GoToStreamPanel.Execute(null);
                    }
                    break;

                    case VLCAction.VolumeUp:
                        Locator.MediaPlaybackViewModel.ChangeVolumeCommand.Execute("higher");
                        break;

                    case VLCAction.VolumeDown:
                        Locator.MediaPlaybackViewModel.ChangeVolumeCommand.Execute("lower");
                        break;

                    case VLCAction.TabNext:
                        var pivotIndex = Locator.MainVM.Panels.IndexOf(Locator.MainVM.CurrentPanel);
                        pivotIndex = (pivotIndex < Locator.MainVM.Panels.Count - 1) ? ++pivotIndex : 0;
                        Locator.NavigationService.Go(Locator.MainVM.Panels[pivotIndex].Target);
                        break;
                    }
                }
            }
        }
コード例 #27
0
 public SpeechActionProcessor()
 {
     this.speechProcessor = new SpeechProcessor();;
     this.deactivateSpeechAction = new DeactivateAction();
     this.activateSpeechAction = new ActivateSpeechAction();
 }
コード例 #28
0
 internal AboutToAbortSpeechState(KeyboardAction<FaceState> cursorAction)
     : base(cursorAction)
 {
 }
コード例 #29
0
        public ImageProcessor(FormMain mainForm, LoginService loginService, GesturesService gesturesService, TrainingBox trainBox, CursorSimulator cursorSimulator)
        {
            try
            {
                this.cursorSimulator = cursorSimulator;
                this.webCam = new Capture(); //Inicializa la camara
                this.mainForm = mainForm;
                this.loginService = loginService;
                this.gesturesService = gesturesService;
                this.trainBox = trainBox;

                this.clickTimer = new Stopwatch();
                this.mouthTimer = new Stopwatch();
                this.speechProcessor = new SpeechProcessor();
                this.eyeDetector = new EyeDetector();
                this.faceDetector = new FaceDetector(this.eyeDetector);
                this.cursorLoopProcessor = new CursorLoopProcessor(this.cursorSimulator);
                this.cursorActionProcessor = new CursorActionProcessor();
                this.deactivateActionProcessor = new DeactivateActionProcessor(this.speechProcessor, this.cursorLoopProcessor);

                this.activateSpeechAction = new ActivateSpeechAction();

                Application.Idle += new EventHandler(this.cursorLoopProcessor.Pool);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #30
0
 internal ShouldActivateSpeechState(KeyboardAction<FaceState> cursorAction)
     : base(cursorAction)
 {
 }
コード例 #31
0
ファイル: Settings.cs プロジェクト: CanPayU/SuperSwungBall
 public void UpdateKeyboard(KeyboardAction action, KeyCode code)
 {
     this.keyboard[action] = code;
 }
コード例 #32
0
        private static IAction GetAction(ActionModel action)
        {
            IAction actionInstance = null;

            switch (action.Action)
            {
            case ActionType.WriteFile:
                actionInstance = new WriteFileAction();
                break;

            case ActionType.IF:
                actionInstance = new IFAction();
                break;

            case ActionType.HttpRequest:
                actionInstance = new HttpRequestAction();
                break;

            case ActionType.Shutdown:
                actionInstance = new ShutdownAction();
                break;

            case ActionType.StartProcess:
                actionInstance = new StartProcessAction();
                break;

            case ActionType.OpenURL:
                actionInstance = new OpenURLAction();
                break;

            case ActionType.Snipping:
                actionInstance = new SnippingAction();
                break;

            case ActionType.DeleteFile:
                actionInstance = new DeleteFileAction();
                break;

            case ActionType.SoundPlay:
                actionInstance = new SoundPlayAction();
                break;

            case ActionType.GetIPAddress:
                actionInstance = new GetIPAddressAction();
                break;

            case ActionType.Keyboard:
                actionInstance = new KeyboardAction();
                break;

            case ActionType.SystemNotification:
                actionInstance = new SystemNotificationAction();
                break;

            case ActionType.DownloadFile:
                actionInstance = new DownloadFileAction();
                break;

            case ActionType.Dialog:
                actionInstance = new DialogAction();
                break;

            case ActionType.Delay:
                actionInstance = new DelayAction();
                break;

            case ActionType.Loops:
                actionInstance = new LoopsAction();
                break;

            case ActionType.KillProcess:
                actionInstance = new KillProcessAction();
                break;

            case ActionType.SetDeviceVolume:
                actionInstance = new SetDeviceVolumeAction();
                break;

            case ActionType.Regex:
                actionInstance = new RegexAction();
                break;

            case ActionType.ReadFile:
                actionInstance = new ReadFileAction();
                break;

            case ActionType.JsonDeserialize:
                actionInstance = new JsonDeserializeAction();
                break;
            }
            if (actionInstance != null)
            {
                return(actionInstance);
            }
            return(null);
        }
コード例 #33
0
 public void HandleKeyboardAction(KeyboardAction keyboardAction)
 {
 }
コード例 #34
0
 internal InitialActivateSpeechState(KeyboardAction<FaceState> action)
     : base(action)
 {
 }
コード例 #35
0
        async Task DoKeyboardAction(KeyboardAction keyboardAction)
        {
            // determine if it's a combination of keys or not

            if (virtualKeys[1] == VirtualKey.None && virtualKeys[2] == VirtualKey.None)
            {
                // this is a simple shortcut
                switch (keyboardAction.Action)
                {
                case VLCAction.PauseToggle:
                    if (Locator.MediaPlaybackViewModel.MediaState == MediaState.Paused ||
                        Locator.MediaPlaybackViewModel.MediaState == MediaState.Playing)
                    {
                        Locator.MediaPlaybackViewModel._mediaService.Pause();
                    }
                    break;

                case VLCAction.Quit:
                    App.Current.Exit();
                    break;

                case VLCAction.Stop:
                    if (Locator.MediaPlaybackViewModel.PlayingType == PlayingType.Video)
                    {
                        Locator.MediaPlaybackViewModel.GoBack.Execute(null);
                    }
                    break;

                case VLCAction.Previous:
                    if (Locator.MediaPlaybackViewModel.PlayingType == PlayingType.Music)
                    {
                        await Locator.MediaPlaybackViewModel.PlayPrevious();
                    }
                    break;

                case VLCAction.Next:
                    if (Locator.MediaPlaybackViewModel.PlayingType == PlayingType.Music)
                    {
                        await Locator.MediaPlaybackViewModel.PlayNext();
                    }
                    break;
                }
            }
            else if (virtualKeys[2] == VirtualKey.None)
            {
                // two keys shortcut
                if (virtualKeys[0] == VirtualKey.Control && virtualKeys[1] == keyboardAction.SecondKey)
                {
                    //two keys shortcut, first key is Ctrl
                    switch (keyboardAction.Action)
                    {
                    case VLCAction.OpenFile:
                    {
                        Locator.MediaPlaybackViewModel.PickVideoCommand.Execute(null);
                    }
                    break;

                    case VLCAction.OpenNetwork:
                    {
                        Locator.MainVM.OpenStreamFlyout();
                    }
                    break;
                    }
                }
            }
        }
コード例 #36
0
 internal NotAboutToActivateSpeechState(KeyboardAction<FaceState> action)
     : base(action)
 {
 }
コード例 #37
0
 private void RaiseKeyboardAction(KeyboardAction action)
 {
     Action?.Invoke(this, new KeyboardActionEventArgs(action));
 }
コード例 #38
0
 /// <summary>
 /// Creates an action from a given string identifier.
 /// Throws an exception if the given string specifies a key or gamepad control that does not exist.
 /// </summary>
 /// <param name="value">The action name.</param>
 /// <returns>A valid and functional action if the name is valid;
 /// null if neither a keyboard nor a gamepad action is specified;
 /// a non functional dummy action with correct name, if a gamepad action for a not connected gamepad is specified.</returns>
 public static IAction FromString(string value)
 {
     return(value.ToLowerInvariant().Trim() == "unbound"
         ? InputAction.Unbound
         : KeyboardAction.FromString(value) ?? GamePadAction.FromString(value));
 }