Exemple #1
0
        private void KeyboardChange_Callback(KeyboardChangeEventArgs args)
        {
            if (!IsActive)
            {
                return;
            }
            foreach (var s in args.StateComparisions.Select(x => x.Value))
            {
                if (s.Key == Keys.F11 && s.OldState == KeyState.Up && s.CurrentState == KeyState.Down)
                {
                    GraphicsDeviceManager.ToggleFullScreen();
                }

                Debug(string.Format("KeyboardChange_Callback() Key:{0}, Old:{1}, New:{2}", s.Key, s.OldState, s.CurrentState));
            }


            //KeyStateComparision keyState;
            //if (args.StateComparisions.TryGetValue(Keys.LeftAlt, out keyState) && keyState.CurrentState == KeyState.Down)
            //{
            //    if (args.StateComparisions.TryGetValue(Keys.F4, out keyState) && keyState.CurrentState == KeyState.Down)
            //        Exit();
            //}

            ScreenManager._InvokeKeyboardChange(args);
        }
Exemple #2
0
        public override void OnKeyboardChange(KeyboardChangeEventArgs args)
        {
            KeyStateComparision keyState;

            if (args.StateComparisions.TryGetValue(Keys.Escape, out keyState) && keyState.OldState == KeyState.Up && keyState.CurrentState == KeyState.Down)
            {
                _browserForm.Close();
                args.Handled = true;
                base.OnKeyboardChange(args);
                return;
            }


            //if (args.StateComparisions.TryGetValue(Keys.Up, out keyState) && keyState.OldState == KeyState.Up && keyState.CurrentState == KeyState.Down)
            //{
            //    var oldScrollPos = _browserForm.GetVerticalScrollPosition();
            //    var scrollPos = Math.Max(0, oldScrollPos - _scrollStrength);
            //    if (oldScrollPos != scrollPos)
            //        _browserForm.SetVerticalScrollPosition(scrollPos);
            //    args.Handled = true;
            //}
            //if (args.StateComparisions.TryGetValue(Keys.Down, out keyState) && keyState.OldState == KeyState.Up && keyState.CurrentState == KeyState.Down)
            //{
            //    var scrollPos = _browserForm.GetVerticalScrollPosition() + _scrollStrength;
            //    _browserForm.SetVerticalScrollPosition(scrollPos);
            //    args.Handled = true;
            //}

            base.OnKeyboardChange(args);
        }
        internal void _InvokeKeyboardChange(KeyboardChangeEventArgs args)
        {
            var screens = GetScreens().ToList();

            screens = screens.Where(x => x.ScreenState == ScreenState.Active).ToList();
            //if (!inherit)
            //    screens = screens.Where(x => x.IsActive).ToList();

            screens.Reverse();
            foreach (var screen in screens)
            {
                if (args.Handled)
                {
                    break;
                }
                screen._InvokeKeyboardChange(args);
                //break;      // only focused screen should recieve input
            }
        }
Exemple #4
0
        public override void OnKeyboardChange(KeyboardChangeEventArgs args)
        {
            // todo: support holding down the button for X milliseconds

            KeyStateComparision keyState;

            if (args.StateComparisions.TryGetValue(Keys.Left, out keyState) && keyState.OldState == KeyState.Up && keyState.CurrentState == KeyState.Down)
            {
                SelectLeft();
                args.Handled = true;
            }
            if (args.StateComparisions.TryGetValue(Keys.Right, out keyState) && keyState.OldState == KeyState.Up && keyState.CurrentState == KeyState.Down)
            {
                SelectRight();
                args.Handled = true;
            }
            if (args.StateComparisions.TryGetValue(Keys.Enter, out keyState) && keyState.OldState == KeyState.Up && keyState.CurrentState == KeyState.Down)
            {
                OpenItem(_focusedItemSprite);
                args.Handled = true;
            }

            base.OnKeyboardChange(args);
        }
Exemple #5
0
 public virtual void OnKeyboardChange(KeyboardChangeEventArgs args)
 {
 }
Exemple #6
0
 internal void _InvokeKeyboardChange(KeyboardChangeEventArgs args)
 {
     OnKeyboardChange(args);
 }