SIL.Windows.Forms.Keyboarding/Windows/WinKeyboardAdaptor.cs
/// <summary>
/// Gets the keyboard description for the layout of <paramref name="inputLanguage"/>.
/// </summary>
Gets the keyboard description for the layout of .
Gets the keyboard description for the layout of .
private static KeyboardDescription GetKeyboardDescription(IInputLanguage inputLanguage)
		{
			KeyboardDescription sameLayout = KeyboardController.NullKeyboard;
			KeyboardDescription sameCulture = KeyboardController.NullKeyboard;
			string requestedLayout = GetLayoutNameEx(inputLanguage.Handle).Name;
			foreach (WinKeyboardDescription keyboardDescription in KeyboardController.Instance.AvailableKeyboards.OfType<WinKeyboardDescription>())
			{
				try
				{
					if (requestedLayout == keyboardDescription.Layout)
					{
						if (keyboardDescription.Locale == inputLanguage.Culture.Name)
							return keyboardDescription;
						if (sameLayout == null)
							sameLayout = keyboardDescription;
					}
					else if (keyboardDescription.Locale == inputLanguage.Culture.Name && sameCulture == null)
						sameCulture = keyboardDescription;
				}
				catch (CultureNotFoundException)
				{
				}
			}
			return sameLayout ?? sameCulture;
		}
private static KeyboardDescription GetKeyboardDescription ( IInputLanguage inputLanguage ) { KeyboardDescription sameLayout = KeyboardController . NullKeyboard ; KeyboardDescription sameCulture = KeyboardController . NullKeyboard ; string requestedLayout = GetLayoutNameEx ( inputLanguage . Handle ) . Name ; foreach ( WinKeyboardDescription keyboardDescription in KeyboardController . Instance . AvailableKeyboards . OfType < WinKeyboardDescription > ( ) ) { try { if ( requestedLayout == keyboardDescription . Layout ) { if ( keyboardDescription . Locale == inputLanguage . Culture . Name ) return keyboardDescription ; if ( sameLayout == null ) sameLayout = keyboardDescription ; } else if ( keyboardDescription . Locale == inputLanguage . Culture . Name && sameCulture == null ) sameCulture = keyboardDescription ; } catch ( CultureNotFoundException ) { } } return sameLayout ?? sameCulture ; }
Gets the keyboard description for the layout of .
Gets the keyboard description for the layout of .
// TODO: write some tests // we get an exception for non-supported cultures, probably because of a // badly applied .NET patch. // http://www.ironspeed.com/Designer/3.2.4/WebHelp/Part_VI/Culture_ID__XXX__is_not_a_supported_culture.htm and others
inputLanguage
IInputLanguage