Ejemplo n.º 1
0
 /// <summary>
 /// Evento asociado a la entrada de teclado. Se activa cuando se pulsa sobre alguna tecla.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void CoreWindow_CharacterReceived(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.CharacterReceivedEventArgs args)
 {
     if (viewModel.Repeat)
     {
         if (args.KeyCode == 119)  //Arriba
         {
             viewModel.tryMoveCharacter('u');
         }
         else if (args.KeyCode == 115)     //Abajo
         {
             viewModel.tryMoveCharacter('d');
         }
         else if (args.KeyCode == 97)     //Izquierda
         {
             viewModel.tryMoveCharacter('l');
         }
         else if (args.KeyCode == 100)     //Derecha
         {
             viewModel.tryMoveCharacter('r');
         }
         else if (args.KeyCode == 27)     //Si pulsa escape
         {
             viewModel.ReiniciarJuego();
             this.Frame.Navigate(typeof(MenuPrincipal));
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Hot keys
 /// </summary>
 void CoreWindow_CharacterReceived(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.CharacterReceivedEventArgs args)
 {
     if (args.KeyCode == 26)             //Ctrl+Z
     {
         Button_Click_2(null, null);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// スペースキーでZoomingをon/off
 /// 1,2,3キーでズーム速度切り替え
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void CoreWindow_CharacterReceived(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.CharacterReceivedEventArgs args)
 {
     switch (args.KeyCode)
     {
         case (uint)(Windows.System.VirtualKey.Space):
             ToggleZooming();
             break;
         case (uint)(Windows.System.VirtualKey.Number1):
             speed = 1d;
             break;
         case (uint)(Windows.System.VirtualKey.Number2):
             speed = 2d;
             break;
         case (uint)(Windows.System.VirtualKey.Number3):
             speed = 3d;
             break;
     }
     if (args.KeyCode == 27) //Escape
     {
         // your code here fore Escape key
     }
     if (args.KeyCode == 13) //Enter
     {
         // your code here fore Enter key
     }
 }
Ejemplo n.º 4
0
        private void CoreWindow_CharacterReceived(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.CharacterReceivedEventArgs args)
        {
            var code = args.KeyCode;

            Log.Debug(code.ToString());

            if (code == 13) //enter
            {
                Frame    rootFrame = Window.Current.Content as Frame;
                MainPage main      = rootFrame.Content as MainPage;
                string   s         = main.getText();
                if (s != "")
                {
                    str = s;
                }
                if (str != "")
                {
                    Uri uri = new Uri("http://www.aimer.com.cn/goods/" + str);
                    vetrtcalPage.Source = (uri);
                    hideGoodsScene();
                    getGoodsScenes(str);
                }
                str = "";
            }

            else if (code >= 48 && code <= 57) //0-9
            {
                str = str + (args.KeyCode - 48);
            }
            else if (code >= 97 && code <= 122) //a-z
            {
                str = str + (char)code;
            }
        }
 private void CoreWindow_CharacterReceived(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.CharacterReceivedEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine(e.KeyCode);
     // K = 11
 }