示例#1
0
        /// <summary>
        /// Updates the keyboard state for a given MIDI pitch.
        /// </summary>
        /// <param name="midiPitch">The MIDI pitch of the key to update.</param>
        /// <param name="depressed">True if the key was pressed, false if it was released.</param>
        private void UpdateState(Pitch midiPitch, bool depressed)
        {
            if (depressed)
            {
                state.PressKey(midiPitch);
            }
            else
            {
                state.ReleaseKey(midiPitch);
            }

            // Raise an event to allow others to update
            KeyboardStateChanged?.Invoke(this, new EventArgs());
        }
示例#2
0
        private void NotifyKeyboardState(KeyboardEventTypes eventType, UIKeyboardEventArgs eventArgs)
        {
            _lastState = eventType;

            if (eventType == KeyboardEventTypes.DidHide)
            {
                _keyboardHeight = 0;
            }
            else
            {
                _keyboardHeight = CalculateKeyboardHeight(eventArgs);
            }

            KeyboardStateChanged?.Invoke(this, new KeyboardStateEventArgs
            {
                EventType      = eventType,
                KeyboardHeight = _keyboardHeight
            });
        }