Beispiel #1
0
        void InvokeUIAction_LockKey(int keyCode)
        {
            switch (keyCode)
            {
            case KeyModel.CAPSLOCK_KEYCODE:
            {
                bool isState = Keyboard.IsKeyToggled(Key.CapsLock);

                KeyModel.CapsUpdate(isState);

                // 해당범위 UI 업데이트
                UI_Update(true, true, KeyModel.GetCapsIndexArray());

                break;
            }

            case KeyModel.NUMLOCK_KEYCODE:
            {
                bool isState = Keyboard.IsKeyToggled(Key.NumLock);

                KeyModel.NumUpdate(isState);

                // 해당범위 UI 업데이트

                UI_Update(true, true, KeyModel.GetNumIndexArray(true));
                UI_Update(true, true, KeyModel.GetNumIndexArray(false));

                break;
            }

            case KeyModel.SCROLLLOCK_KEYCODE:
                break;
            }
        }
Beispiel #2
0
        void UI_Update(bool _isTextUpdate, bool _isColorUpdate, int[] _idx_range)
        {
            for (int i = 0; i < _idx_range.Length; i++)
            {
                int idx = _idx_range[i];

                if (idx >= GridKeyLayout.Children.Count)
                {
                    continue;
                }

                string keyview = KeyModel.GetKeyView(idx);

                TextBlock tbx = GetTextBlock(idx);

                if (_isTextUpdate)
                {
                    tbx.Text = keyview;
                }

                if (_isColorUpdate)
                {
                    Border bdr = GetBorder(idx);
                    UI_ColorUpdate(bdr, tbx);
                }
            }
        }
Beispiel #3
0
        void InvokeUIAction_LogInput(int _keyCode, double _time, bool _isPush)
        {
            var keyidx = KeyModel.KeyCode2Index(_keyCode);

            for (int i = 0; i < keyidx.Count; i++)
            {
                int idx = keyidx[i];
                if (idx > KeyModel.ERROR_INT)
                {
                    Border    bdr = GetBorder(idx);
                    TextBlock tbx = GetTextBlock(idx);

                    UI_ColorUpdate(bdr, tbx, _isPush);
                }
            }

            string timeStr = Ms2Str(_time);

            string keyName = KeyModel.KeyCode2KeyName(_keyCode);

            string isPushStr = _isPush ? "PUSH" : "PULL";

            tbxLog.AppendText($"[{timeStr}] [{isPushStr}]\t {keyName}\n");
            tbxLog.ScrollToEnd(); // 스크롤 아래로
        }