Exemple #1
0
 private void Button_KeyDown(object sender, KeyEventArgs e)
 {
     //MessageBox.Show(e.Key.ToString());
     foreach (Grid grid in keyboard.Children)
     {
         foreach (Control item in grid.Children)
         {
             ButtonWithKey btn = item as ButtonWithKey;
             if (btn != null)
             {
                 if (btn.Key == Key.CapsLock || btn.Key == Key.LeftShift || btn.Key == Key.RightShift)
                 {
                     SetChar();
                 }
                 if (btn.Key == e.Key)
                 {
                     btn.IsPress = true;
                     if (btn.CharCaps != null && isTape)
                     {
                         if (!caps)
                         {
                             Verify(btn.Char);
                         }
                         else
                         {
                             Verify(btn.CharCaps);
                         }
                     }
                 }
             }
         }
     }
 }
Exemple #2
0
 private void LoadKeys()
 {
     foreach (Grid grid in keyboard.Children)
     {
         foreach (Control item in grid.Children)
         {
             ButtonWithKey btn = item as ButtonWithKey;
             btn?.SetChar(caps);
         }
     }
 }
Exemple #3
0
 private void GetChars()
 {
     lowChars  = new List <char>();
     capsChars = new List <char>();
     foreach (Grid grid in keyboard.Children)
     {
         foreach (Control item in grid.Children)
         {
             ButtonWithKey btn = item as ButtonWithKey;
             if (btn != null)
             {
                 if (btn.CharCaps != null)
                 {
                     lowChars.Add(btn.Char[0]);
                     capsChars.Add(btn.CharCaps[0]);
                 }
             }
         }
     }
 }
Exemple #4
0
 private void Button_KeyUp(object sender, KeyEventArgs e)
 {
     foreach (Grid grid in keyboard.Children)
     {
         foreach (Control item in grid.Children)
         {
             ButtonWithKey btn = item as ButtonWithKey;
             if (btn != null)
             {
                 if (btn.Key == Key.CapsLock || btn.Key == Key.LeftShift || btn.Key == Key.RightShift)
                 {
                     SetChar();
                 }
                 if (btn.Key == e.Key)
                 {
                     btn.IsPress = false;
                 }
             }
         }
     }
 }