Пример #1
0
		public static int OrdinalValue(Keycode key)
		{
			if (key == BUTTON_A) {
				return 0;
			} else if (key == BUTTON_B) {
				return 1;
			} else if (key == BUTTON_X) {
				return 2;
			} else if (key == BUTTON_Y) {
				return 3;
			} else if (key == BUTTON_L1) {
				return 4;
			} else if (key == BUTTON_R1) {
				return 5;
			} else if (key == BUTTON_L2) {
				return 6;
			} else if (key == BUTTON_R2) {
				return 7;
			} else if (key == BUTTON_SELECT) {
				return 8;
			} else if (key == BUTTON_START) {
				return 9;
			} else if (key == BUTTON_THUMBL) {
				return 10;
			} else if (key == BUTTON_THUMBR) {
				return 11;
			} else if (key == BACK) {
				return 12;
			} else if (key == POWER) {
				return 13;
			} else {
				return -1;
			}

		}
Пример #2
0
 public bool OnKey(View v, Keycode keyCode, KeyEvent e)
 {
     if (e.KeyCode == Keycode.Enter && e.Action == 0) {
         activity.EnterKeyPressed ();
     }
     return false;
 }
Пример #3
0
 public override bool OnKeyUp(Keycode keyCode, KeyEvent keyEvent)
 {
     //Log.Info(TAG, "OnKeyUp=" + (int)keyCode);
     int playerNum = OuyaController.getPlayerNumByDeviceId(keyEvent.DeviceId);
     if (playerNum >= 0 && playerNum < 4)
     {
         if ((int)keyCode == OuyaController.BUTTON_DPAD_DOWN)
         {
             _game.GetFocusManager().FocusDown();
         }
         if ((int)keyCode == OuyaController.BUTTON_DPAD_LEFT)
         {
             _game.GetFocusManager().FocusLeft();
         }
         if ((int)keyCode == OuyaController.BUTTON_DPAD_RIGHT)
         {
             _game.GetFocusManager().FocusRight();
         }
         if ((int)keyCode == OuyaController.BUTTON_DPAD_UP)
         {
             _game.GetFocusManager().FocusUp();
         }
         if ((int)keyCode == OuyaController.BUTTON_O)
         {
             _game.GetFocusManager().InvokeClick();
         }
         if ((int)keyCode == OuyaController.BUTTON_A)
         {
             _game.Exit();
         }
     }
     return true;
 }
Пример #4
0
 public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
 {
     if (keyCode == Keycode.Back)
         return base.OnKeyUp (keyCode, e);
     else
         return jetboy_thread.DoKeyUp (keyCode, e);
 }
Пример #5
0
        public bool keypress(Keycode keyCode)
        {
            if (keyCode == Keycode.DpadUp || keyCode == Keycode.VolumeUp) {
                if (mode == GameMode.Ready | mode == GameMode.Lost) {

                    InitNewGame ();

                    SetMode (GameMode.Running);
                    Update ();

                    return true;
                }

                if (mode == GameMode.Paused) {

                    SetMode (GameMode.Running);
                    Update ();

                    return true;
                }

                if (keyCode == Keycode.VolumeUp) {
                    mSig_Direccion = (Direccion) (((int)mDireccion + 1) % 4);
                } else {
                    if (mDireccion != Direccion.Abajo)
                        mSig_Direccion = Direccion.Arriba;
                }

                return true;
            }

            if (keyCode == Keycode.DpadDown) {
                if (mDireccion != Direccion.Arriba)
                    mSig_Direccion = Direccion.Abajo;

                return true;
            }

            if (keyCode == Keycode.VolumeDown) {
                mSig_Direccion = (Direccion) (((int)mDireccion - 1) % 4);

                return true;
            }

            if (keyCode == Keycode.DpadLeft) {
                if (mDireccion != Direccion.Derecha)
                    mSig_Direccion = Direccion.Izquierda;

                return true;
            }

            if (keyCode == Keycode.DpadRight) {
                if (mDireccion != Direccion.Izquierda)
                    mSig_Direccion = Direccion.Derecha;

                return (true);
            }
            return (true);
        }
Пример #6
0
        // If Back button is pressed, return previous fragment.
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back) {
                return PopFragment();
            }

            return base.OnKeyDown(keyCode, e);
        }
Пример #7
0
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back) {

                Finish ();
            }
            return base.OnKeyDown (keyCode, e);
        }
Пример #8
0
 public bool OnKeyUp(Keycode keycode, KeyEvent keyEvent)
 {
     if (keycode == Keycode.Back && _slidingMenu.IsMenuShowing)
     {
         ShowContent();
         return true;
     }
     return false;
 }
Пример #9
0
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back && WaveServices.Platform != null)
            {
                WaveServices.Platform.Exit();
            }

            return base.OnKeyDown(keyCode, e);
        }
Пример #10
0
 public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
 {
     if (keyCode == Keycode.Back)
     {
         WaveEngine.Adapter.Input.InputManager inputManager = (WaveEngine.Adapter.Input.InputManager)adapter.InputManager;
         inputManager.GamePadState.Buttons.Back = ButtonState.Release;
     }
     return true;
 }
Пример #11
0
 internal static void KeyDown(Keycode keyCode)
 {
     Keys key;
     if (KeyMap.TryGetValue(keyCode, out key))
     {
         if (!keys.Contains(key))
             keys.Add(key);
     }
 }
Пример #12
0
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Menu) {
                StartActivity (typeof(SettingsActivity));
                return true;
            }

            return base.OnKeyDown (keyCode, e);
        }
Пример #13
0
			bool View.IOnKeyListener.OnKey (View v, Keycode keyCode, KeyEvent e)
			{
				if (e.Action == KeyEventActions.Down && keyCode == Keycode.Enter) {
					Logger.Debug ("entered pressed");
					OnSend ();
					return true;
				}
				return false;
			}
Пример #14
0
 internal static void KeyUp(Keycode keyCode)
 {
     Keys key;
     if (KeyMap.TryGetValue(keyCode, out key))
     {
         if (keys.Contains(key))
             keys.Remove(key);
     }
 }
Пример #15
0
		public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
		{
			if (keyCode == Keycode.Back) {
				oauthWebView.close (true);
				return true;
			} else {
				return base.OnKeyDown (keyCode, e);
			}
		}
Пример #16
0
		public override bool OnKeyPreIme(Keycode keyCode, KeyEvent e)
		{
			if (keyCode == Keycode.Back && e.Action == KeyEventActions.Down)
			{
				EventHandler handler = OnKeyboardBackPressed;
				if (handler != null)
					handler(this, EventArgs.Empty);
			}
			return base.OnKeyPreIme(keyCode, e);
		}
        public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back)
            {
                webView.ClearCache(true);
                Finish();
            }

            return base.OnKeyUp (keyCode, e);
        }
Пример #18
0
		public override bool OnKeyUp (Keycode keyCode, KeyEvent e)
		{
			if (keyCode == Keycode.Back) {
				Intent intent = new Intent(Intent.ActionMain);
				intent.AddCategory(Intent.CategoryHome);
				intent.SetFlags(ActivityFlags.NewTask);
				StartActivity(intent);
			}
			return true;
		}
Пример #19
0
        public bool OnKey(View v, Keycode keyCode, KeyEvent e)
        {
            EditText barcode = (EditText)v;
            if (keyCode == Keycode.Enter||e.KeyCode== Keycode.NumpadEnter) {
                Txtbarcode_AfterTextChanged (barcode);
                return true;
            }

            //barcode.Text = barcode.Text + keyCode;
            return false;
        }
Пример #20
0
        public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back || e.KeyCode == Keycode.Back)
            {
                var activity = this.Context as Activity;

                activity.FragmentManager.PopBackStack();
            }

            return true;
        }
Пример #21
0
 public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
 {
     if (keyCode == Keycode.Back)
     {
         status = DialogManager.ShowStatus(this, Database.GetText("Communicating", "System"));
         backFuncs[model]();
         this.Finish();
         return true;
     }
     return base.OnKeyDown(keyCode, e);
 }
Пример #22
0
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back) {

                this.SupportFragmentManager.PopBackStack ();

                return true;
            }

            return base.OnKeyDown (keyCode, e);
        }
Пример #23
0
        public bool OnKeyUp(Keycode keyCode, KeyEvent e)
        {
            if (keyCode != Keycode.Back) return false;

            if (!_hostScreen.Router.NavigateBack.CanExecute(null)) return false;

            if (_inner == null) return false;

            _hostScreen.Router.NavigateBack.Execute(null);
            return true;
        }
Пример #24
0
 public bool OnKey(IDialogInterface dialog, Keycode keyCode, KeyEvent e)
 {
     if (e.KeyCode == Keycode.Back)
         switch (e.Action)
         {
             case KeyEventActions.Down: return Down;
             case KeyEventActions.Multiple: return Multiple;
             case KeyEventActions.Up: return Up;
         }
     return false;
 }
Пример #25
0
            public override bool OnKeyPreIme(Keycode keyCode, KeyEvent e)
            {
                if (e.KeyCode == Keycode.Back)
                {
                    if (activeEditText != null)
                        activeEditText.IsSelectionActive = false;

                    return true;
                }

                return base.OnKeyPreIme(keyCode, e);
            }
Пример #26
0
 // hardware button callbacks
 public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
 {
     switch (keyCode) {
         case Keycode.VolumeDown:
             PreviousSlide();
             return true;
         case Keycode.VolumeUp:
             NextSlide();
             return true;
     }
     return base.OnKeyUp(keyCode, e);
 }
Пример #27
0
 public override bool OnKeyDown(Keycode keyCode, KeyEvent events)
 {
     // Exit fullscreen when the user pressed the Back button
     if (keyCode == Keycode.Back)
     {
         if (mPlayerView.Fullscreen)
         {
             mPlayerView.SetFullscreen(false, true);
             return(false);
         }
     }
     return(base.OnKeyDown(keyCode, events));
 }
        public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.VolumeUp)
            {
                return(true);
            }
            else if (keyCode == Keycode.VolumeDown)
            {
                return(true);
            }

            return(base.OnKeyDown(keyCode, e));
        }
Пример #29
0
        public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.VolumeDown)
            {
                return(true);
            }

            if (keyCode == Keycode.VolumeUp)
            {
                return(true);
            }
            return(base.OnKeyUp(keyCode, e));
        }
Пример #30
0
        internal static bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            var gamePad = GetGamePad(e.Device);

            if (gamePad == null)
            {
                return(false);
            }

            gamePad._buttons |= ButtonForKeyCode(keyCode);

            return(true);
        }
Пример #31
0
        public override bool OnKeyUp(Keycode keyCode, KeyEvent keyEvent)
        {
            if (keyCode == Keys.VolumeDown || keyCode == Keys.VolumeUp)
            {
                return(false);
            }

            lock (motionEvents)
            {
                keysEvents.Add(keyEvent);
            }
            return(true);
        }
Пример #32
0
        public bool OnKey(View v, Keycode keyCode, KeyEvent e)
        {
            EditText barcode = (EditText)v;

            if (keyCode == Keycode.Enter || e.KeyCode == Keycode.NumpadEnter)
            {
                Txtbarcode_AfterTextChanged(barcode);
                return(true);
            }

            //barcode.Text = barcode.Text + keyCode;
            return(false);
        }
Пример #33
0
        public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent e)
        {
            if (e.RepeatCount == 0)
            {
                if (keyCode == KeyEvent.KeyCodeFromString("KEYCODE_STEM_1"))
                {
                    StartWorkout();
                    return(true);
                }
            }

            return(base.OnKeyDown(keyCode, e));
        }
Пример #34
0
 /// <summary>
 /// 禁用回退键
 /// </summary>
 /// <param name="keyCode"></param>
 /// <param name="e"></param>
 /// <returns></returns>
 public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent e)
 {
     if ((keyCode == Keycode.Back))
     {
         if (flashTask.Running)
         {
             var toast = Toast.MakeText(this, "任务运行中,回退已禁用\ntask running,back key disabled", ToastLength.Short);
             toast.Show();
             return(true);
         }
     }
     return(base.OnKeyDown(keyCode, e));
 }
Пример #35
0
 public override bool OnKeyDown(Keycode keycode, KeyEvent paramKeyEvent)
 {
     //管理者基準
     if (keycode == Keycode.Num1)
     {
         StartFragment(FragmentManager, typeof(NyukaMenuFragment));
     }
     else if (keycode == Keycode.Num2)
     {
         StartFragment(FragmentManager, typeof(TsumikaeMenuFragment));
     }
     else if (keycode == Keycode.Num3)
     {
         GotoTusumikomi();
     }
     else if (keycode == Keycode.Num4)
     {
         StartFragment(FragmentManager, typeof(NohinSelectFragment));
     }
     else if (keycode == Keycode.Num5)
     {
         // データ送信
         DataSend();
     }
     else if (keycode == Keycode.Num6)
     {
         // マテハン登録
         StartFragment(FragmentManager, typeof(MatehanMenuFragment));
     }
     else if (keycode == Keycode.Num7)
     {
         // メールバッグ
     }
     else if (keycode == Keycode.Num8)
     {
         // 移動先店舗登録
     }
     else if (keycode == Keycode.Num9)
     {
         // 移動先店舗納品
     }
     else if (keycode == Keycode.Num0)
     {
         // TC2
     }
     else if (keycode == Keycode.Period)
     {
         // 在庫集約
     }
     return(true);
 }
        public static byte[] GetKeycode(Keycode Input)
        {
            switch (Input)
            {
            case Keycode.RANGE:
                return(KEYCODE_RANGE);

            case Keycode.HOLD:
                return(KEYCODE_HOLD);

            case Keycode.REL:
                return(KEYCODE_REL);

            case Keycode.PEAK:
                return(KEYCODE_PEAK);

            case Keycode.MODE:
                return(KEYCODE_MODE);

            case Keycode.MINMAX:
                return(KEYCODE_MINMAX);

            case Keycode.MEM:
                return(KEYCODE_MEM);

            case Keycode.SETUP:
                return(KEYCODE_SETUP);

            case Keycode.LONG_RANGE:
                return(KEYCODE_LONG_RANGE);

            case Keycode.LONG_HOLD:
                return(KEYCODE_LONG_HOLD);

            case Keycode.LONG_REL:
                return(KEYCODE_LONG_REL);

            case Keycode.LONG_PEAK:
                return(KEYCODE_LONG_PEAK);

            case Keycode.LONG_MINMAX:
                return(KEYCODE_LONG_MINMAX);

            case Keycode.LONG_MEM:
                return(KEYCODE_LONG_MEM);

            case Keycode.LONG_SETUP:
                return(KEYCODE_LONG_SETUP);
            }
            return(null);
        }
Пример #37
0
        public override bool OnKeyUp([GeneratedEnum] Keycode keyCode, KeyEvent e)
        {
            var handled = false;

            if (e.IsCtrlPressed)
            {
                switch (keyCode)
                {
                case Keycode.X:
                    _page?.OnKeyCommand(KeyCommand.Cut);
                    break;

                case Keycode.C:
                    _page?.OnKeyCommand(KeyCommand.Copy);
                    handled = true;
                    break;

                case Keycode.V:
                    _page?.OnKeyCommand(KeyCommand.Paste);
                    handled = true;
                    break;

                default:
                    break;
                }
            }
            else
            {
                if (keyCode >= Keycode.A && keyCode <= Keycode.Z)
                {
                    // Letter
                    handled = true;
                }
                else if ((keyCode >= Keycode.Num0 && keyCode <= Keycode.Num9) ||
                         (keyCode >= Keycode.Numpad0 && keyCode <= Keycode.Num9))
                {
                    // Number
                    handled = true;
                }

                var desc = $"{_page?.Name ?? string.Empty} : {nameof(OnKeyUp)} : {keyCode}";
                System.Diagnostics.Debug.WriteLine(desc);

                if (handled)
                {
                    _page?.OnKeyUp(keyCode.ToString(), desc);
                }
            }

            return(handled || base.OnKeyUp(keyCode, e));
        }
        public bool OnKey(View v, [GeneratedEnum] Keycode keyCode, KeyEvent e)
        {
            _keyCounter++;


            if (keyCode == Keycode.Enter && _keyCounter % 2 != 0)
            {
                EditText et = (EditText)v;
                CheckTag(et);
                imm.HideSoftInputFromWindow(v.WindowToken, 0);
            }

            return(false);
        }
 internal Task <KeyRegistration> InsertRegistration(Keycode key)
 {
     try
     {
         var content = new FormUrlEncodedContent(new[]
         {
             new KeyValuePair <string, string>("keyRegistration", JsonConvert.SerializeObject(key))
         });
     }
     catch (Exception ex) // Failed to connect TODO proper handling
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #40
0
        public async Task <IHttpActionResult> DeleteKeycode(string id)
        {
            Keycode keycode = await db.Keycodes.FindAsync(id);

            if (keycode == null)
            {
                return(NotFound());
            }

            db.Keycodes.Remove(keycode);
            await db.SaveChangesAsync();

            return(Ok(keycode));
        }
Пример #41
0
 //nel caso l'utente preme il tasto back del telefono, lo continua  aportare alla home per uscire deve fare logout
 public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
 {
     switch (keyCode)
     {
     // in smartphone
     case Keycode.Back:
         Intent openPage1 = new Intent(this, typeof(Home));
         String username  = Intent.GetStringExtra("username");
         openPage1.PutExtra("username", username);
         StartActivity(openPage1);
         break;
     }
     return(base.OnKeyDown(keyCode, e));
 }
        public override bool OnKeyDown(Keycode keycode, KeyEvent @event)
        {
            bool handled = false;

            try{
                Finish();
                StartActivity(typeof(CardCategoriaLoja));
                handled = true;
            }
            catch {
                handled = false;
            }
            return(handled || base.OnKeyDown(keycode, @event));
        }
Пример #43
0
 public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
 {
     if (keyCode == Keycode.VolumeUp)
     {
         _gestureManager.SensitivityUp();
         return(false);
     }
     if (keyCode == Keycode.VolumeDown)
     {
         _gestureManager.SensitivityDown();
         return(false);
     }
     return(base.OnKeyUp(keyCode, e));
 }
Пример #44
0
 public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
 {
     if (keyCode == Keycode.VolumeDown)
     {
         VolumeDown?.Invoke(this, new EventsArgs <int>(-1));
         return(true);
     }
     else if (keyCode == Keycode.VolumeUp)
     {
         VolumeUp?.Invoke(this, new EventsArgs <int>(1));
         return(true);
     }
     return(base.OnKeyDown(keyCode, e));
 }
 /// <summary>
 /// 监听按键
 /// </summary>
 /// <param name="keyCode">按键码</param>
 /// <param name="event">按键事件</param>
 public void OnKeyEvent(Keycode keyCode, KeyEvent @event)
 {
     foreach (var item in _keyMonitorEvents)
     {
         try
         {
             item.OnKeyEvent(keyCode, @event);
         }
         catch (Exception)
         {
             // ignored
         }
     }
 }
Пример #46
0
        internal static bool KeyUp(Keycode keyCode)
        {
            Keys key;

            if (KeyMap.TryGetValue(keyCode, out key) && key != Keys.None)
            {
                if (keys.Contains(key))
                {
                    keys.Remove(key);
                }
                return(true);
            }
            return(false);
        }
Пример #47
0
        // Implementing IOnKeyboardActionListener interface
        public void OnKey([GeneratedEnum] Keycode primaryCode, [GeneratedEnum] Keycode[] keyCodes)
        {
            if (!this.EditText.IsFocused)
            {
                return;
            }

            // Ensure key is pressed to avoid removing focus
            this.keyPressed = true;

            // Create event for key press
            long eventTime = JavaSystem.CurrentTimeMillis();

            var ev = new KeyEvent(eventTime, eventTime, KeyEventActions.Down, primaryCode, 0, 0, 0, 0,
                                  KeyEventFlags.SoftKeyboard | KeyEventFlags.KeepTouchMode);

            // Ensure native keyboard is hidden
            var imm = (InputMethodManager)this.context.GetSystemService(Context.InputMethodService);

            imm.HideSoftInputFromWindow(this.EditText.WindowToken, HideSoftInputFlags.None);

            this.EditText.InputType = this.inputTypeToUse;

            switch (ev.KeyCode)
            {
            case Keycode.Enter:
                // Sometimes EditText takes long to update the HasFocus status
                if (this.EditText.HasFocus)
                {
                    // Close the keyboard, remove focus and launch command asociated action
                    this.HideKeyboardView();

                    this.ClearFocus();

                    this.entryWithCustomKeyboard.EnterCommand?.Execute(null);
                }

                break;
            }

            // Set the cursor at the end of the text
            this.EditText.SetSelection(this.EditText.Text.Length);

            if (this.EditText.HasFocus)
            {
                this.DispatchKeyEvent(ev);

                this.keyPressed = false;
            }
        }
Пример #48
0
        public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent e)
        {
            if (UserSettings.Control.VolumeButtons && (keyCode == Keycode.VolumeDown || keyCode == Keycode.VolumeUp) && App.IsCurrentPageType(typeof(ReaderPage)))
            {
                var messageBus = IocManager.Container.Resolve <IMessageBus>();
                messageBus.Send(new GoToPageMessage {
                    Next = keyCode == Keycode.VolumeDown, Previous = keyCode == Keycode.VolumeUp
                });

                return(true);
            }

            return(base.OnKeyDown(keyCode, e));
        }
Пример #49
0
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            switch (keyCode)
            {
            case Keycode.Back:
                CancelScan();
                break;

            case Keycode.Focus:
                return(true);
            }

            return(base.OnKeyDown(keyCode, e));
        }
Пример #50
0
 // When key down event is triggered, relay it via local broadcast so fragments can handle it
 public override bool OnKeyDown(Keycode keyCode, KeyEvent msg)
 {
     if (keyCode == Keycode.VolumeDown)
     {
         var intent = new Intent(KeyEventAction);
         intent.PutExtra(KeyEventExtra, (int)keyCode);
         LocalBroadcastManager.GetInstance(this).SendBroadcast(intent);
         return(true);
     }
     else
     {
         return(base.OnKeyDown(keyCode, msg));
     }
 }
Пример #51
0
 public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
 {
     if (keyCode == Keycode.Back)
     {
         if (viERunning)
         {
             StopAll();
             startMain();
         }
         Finish();
         return(true);
     }
     return(base.OnKeyDown(keyCode, e));
 }
Пример #52
0
            public override bool OnKeyPreIme(Keycode keyCode, KeyEvent e)
            {
                if (e.KeyCode == Keycode.Back)
                {
                    if (activeEditText != null)
                    {
                        activeEditText.IsSelectionActive = false;
                    }

                    return(true);
                }

                return(base.OnKeyPreIme(keyCode, e));
            }
Пример #53
0
 /// <summary>
 /// 监听按键
 /// </summary>
 /// <param name="keyCode">按键码</param>
 /// <param name="event">按键事件</param>
 public void OnKeyEvent(Keycode keyCode, KeyEvent @event)
 {
     foreach (var item in _keyMonitorEvents)
     {
         try
         {
             item.OnKeyEvent(keyCode, @event);
         }
         catch (Exception)
         {
             AppApplication.OnLog("异常", $"Error OnKeyEvent: {@event.ToString()} Listener: {item.ToString()}", Color.Red);
         }
     }
 }
Пример #54
0
        public override bool OnKeyUp(Keycode keyCode, KeyEvent keyEvent)
        {
            //Log.Info(TAG, "OnKeyUp=" + (int)keyCode);
            int playerNum = OuyaController.getPlayerNumByDeviceId(keyEvent.DeviceId);

            if (playerNum >= 0 && playerNum < 4 &&
                null != m_game &&
                null != m_game.Controllers &&
                playerNum < m_game.Controllers.Count)
            {
                m_game.Controllers[playerNum].Button[(int)keyCode] = false;
            }
            return(true);
        }
Пример #55
0
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back)
            {
                if (UserInfo.State != StateTypes.Free)
                {
                    UserInfo.MustExit = true;
                }
                Finish( );
                return(true);
            }

            return(base.OnKeyDown(keyCode, e));
        }
Пример #56
0
            bool IDialogInterfaceOnKeyListener.OnKey(IDialogInterface dialog, Keycode keyCode, KeyEvent e)
            {
                if (keyCode != Keycode.Back || e.Action != KeyEventActions.Up)
                {
                    return(false);
                }
                var dialogFragment = _mediator.Target as DialogFragment;

                if (dialogFragment != null)
                {
                    dialogFragment.Dismiss();
                }
                return(true);
            }
Пример #57
0
		public override bool OnKeyDown (Keycode keyCode, KeyEvent e)
		{          
			Console.WriteLine ("OnKeyDown:" + this.ActionBar.Title);
			if (keyCode == Keycode.Back) 
			{
				if (this.ActionBar.Title != null && this.ActionBar.Title.Contains("Login")) {
					// The ROOT page is initially set to have 'Login' in .Title
					// when the app starts (ie. it's hardcoded).
					// If we're on the login page, swallow the back button.
					// Note that when login occurs successfully, the .Title
					// of the page is changed so that the back button works.
					return false;
				}
			}
			return base.OnKeyDown (keyCode, e);
		}
Пример #58
0
        public bool OnKey(View v, Keycode keyCode, KeyEvent e)
        {
            if(e.Action == KeyEventActions.Down && keyCode == Keycode.Enter) {
                if(_addItemEditText.Text.Length == 0) {
                    return true;
                }

                string inputText = _addItemEditText.Text;
                CreateNewListItem(inputText);
                Toast.MakeText(ApplicationContext, "Created new list item!", ToastLength.Long);
                _addItemEditText.Text = "";

                return true;
            }

            return false;
        }
Пример #59
0
 public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
 {
     if (e.Action == KeyEventActions.Down)
     {
         switch (keyCode)
         {
             case Keycode.Back:
                 if (_webView.CanGoBack())
                     _webView.GoBack();
                 else
                     Finish();
                 break;
         }
         return true;
     }
     return base.OnKeyDown(keyCode, e);
 }
Пример #60
0
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.MediaPlayPause)
            {
                if (this._playerFragment.IsPlaying.Value)
                {
                    this._playerFragment.Stop();
                }
                else
                {
                    this._playerFragment.Play();
                }
                return true;
            }

            return base.OnKeyDown(keyCode, e);
        }