/// <summary> /// Tests if key is an input key. Catching the arrow keys is important here. If we didn't return true, OnKeyDown and OnKeyUp would not get /// called for the arrow keys.</summary> /// <param name="keyData">Key</param> /// <returns>True iff key is input key for camera motion</returns> protected override bool IsInputKey(Keys keyData) { if (keyData == KeysInterop.ToWf(s_controlScheme.Left1) || keyData == KeysInterop.ToWf(s_controlScheme.Left2) || keyData == KeysInterop.ToWf(s_controlScheme.Right1) || keyData == KeysInterop.ToWf(s_controlScheme.Right2) || keyData == KeysInterop.ToWf(s_controlScheme.Forward1) || keyData == KeysInterop.ToWf(s_controlScheme.Forward2) || keyData == KeysInterop.ToWf(s_controlScheme.Back1) || keyData == KeysInterop.ToWf(s_controlScheme.Back2)) { return(true); } return(base.IsInputKey(keyData)); }
/// <summary> /// Calling the base ProcessCmdKey allows this key press to be consumed by owning /// controls like PropertyView and PropertyGridView and be seen by ControlHostService. /// Returning false allows the key press to escape to IsInputKey, OnKeyDown, OnKeyUp, etc. /// Returning true means that this key press has been consumed by this method and this /// event is not passed on to any other methods or controls.</summary> /// <param name="msg">Windows message to process</param> /// <param name="keyDataWf">Key data</param> /// <returns>False to allow the key press to escape to IsInputKey, OnKeyDown, OnKeyUp, etc. /// True to consume this key press, so this /// event is not passed on to any other methods or controls.</returns> protected override bool ProcessCmdKey(ref Message msg, Keys keyDataWf) { var keyData = KeysInterop.ToAtf(keyDataWf); if (m_cameraController.HandlesWASD && (keyData == s_controlScheme.Left1 || keyData == s_controlScheme.Left2 || keyData == s_controlScheme.Right1 || keyData == s_controlScheme.Right2 || keyData == s_controlScheme.Forward1 || keyData == s_controlScheme.Forward2 || keyData == s_controlScheme.Back1 || keyData == s_controlScheme.Back2)) { return(false); } return(base.ProcessCmdKey(ref msg, KeysInterop.ToWf(keyData))); }