Пример #1
0
        void KListener_KeyUp(object sender, RawKeyEventArgs args)
        {
            var key = args.Key.ToString();

            foreach (BaseKey item in (MainWindow as MainWindow).KeysPanel.Children.OfType <BaseKey>().ToList())
            {
                if (item.Name == key)
                {
                    (MainWindow as MainWindow).KeysPanel.Children.Remove(item);
                }
            }
        }
Пример #2
0
        void KListener_KeyDown(object sender, RawKeyEventArgs args)
        {
            var key = args.Key.ToString();

            var visual = SetKeyArt(key);

            foreach (BaseKey item in (MainWindow as MainWindow).KeysPanel.Children.OfType <BaseKey>().ToList())
            {
                if (item.Name == key)
                {
                    return;
                }
            }

            (MainWindow as MainWindow).KeysPanel.Children.Add(visual);
        }