public bool TryGetKeyboard(IInputLanguage language, out IKeyboardDefinition keyboard) { // NOTE: on Windows InputLanguage.LayoutName returns a wrong name in some cases. // Therefore we need this overload so that we can identify the keyboard correctly. keyboard = _keyboards.FirstOrDefault(kd => kd.InputLanguage != null && kd.InputLanguage.Equals(language)); return(keyboard != null); }
internal WinKeyboardDescription(string keyboardId, string localizedKeyboardName, string inputLanguageLayoutName, string cultureName, bool isAvailable, IInputLanguage inputLanguage, WinKeyboardAdaptor engine) : base(keyboardId, localizedKeyboardName, inputLanguageLayoutName, cultureName, isAvailable, engine.SwitchingAdaptor) { InputLanguage = inputLanguage; _localizedName = localizedKeyboardName; ConversionMode = (int)(Win32.IME_CMODE.NATIVE | Win32.IME_CMODE.SYMBOL); _useNfcContext = IsKeymanKeyboard(cultureName); }
/// <summary> /// Initializes a new instance of the /// <see cref="SIL.Windows.Forms.Keyboarding.Linux.XkbKeyboardDescription"/> class. /// </summary> public XkbKeyboardDescription(string id, string name, string layout, string locale, bool isAvailable, IInputLanguage language, IKeyboardSwitchingAdaptor engine, int groupIndex) : base(id, name, layout, locale, isAvailable, engine) { InputLanguage = language; GroupIndex = groupIndex; }
public IKeyboardDefinition GetKeyboard(IInputLanguage language) { IKeyboardDefinition keyboard; if (TryGetKeyboard(language, out keyboard)) return keyboard; return _nullKeyboard; }
public IKeyboardDefinition GetKeyboard(IInputLanguage language) { IKeyboardDefinition keyboard; if (TryGetKeyboard(language, out keyboard)) { return(keyboard); } return(NullKeyboard); }
/// <summary> /// Initializes a new instance of the /// <see cref="T:SIL.Windows.Forms.Keyboarding.Windows.WinKeyboardDescription"/> class. /// </summary> internal WinKeyboardDescription(string id, string name, string layout, string locale, bool isAvailable, IInputLanguage inputLanguage, WinKeyboardAdaptor engine, string localizedName, TfInputProcessorProfile profile) : base(id, name, layout, locale, isAvailable, engine) { InputLanguage = inputLanguage; _localizedName = localizedName; InputProcessorProfile = profile; ConversionMode = (int)(Win32.IME_CMODE.NATIVE | Win32.IME_CMODE.SYMBOL); _useNfcContext = !IsKeymanKeyboard(profile); }
/// <summary> /// Initializes a new instance of the /// <see cref="T:SIL.Windows.Forms.Keyboarding.Windows.WinKeyboardDescription"/> class. /// </summary> internal WinKeyboardDescription(string id, string name, string layout, string locale, bool isAvailable, IInputLanguage inputLanguage, WinKeyboardAdaptor engine, string localizedName, TfInputProcessorProfile profile) : base(id, name, layout, locale, isAvailable, engine) { InputLanguage = inputLanguage; _localizedName = localizedName; InputProcessorProfile = profile; ConversionMode = (int) (Win32.IME_CMODE.NATIVE | Win32.IME_CMODE.SYMBOL); _useNfcContext = !IsKeymanKeyboard(profile); }
/// <summary> /// Initializes a new instance of the /// <see cref="T:Palaso.UI.WindowsForms.Keyboard.KeyboardDescription"/> class. /// </summary> internal KeyboardDescription(string name, string layout, string locale, IInputLanguage language, IKeyboardSwitchingAdaptor engine, KeyboardType type = KeyboardType.System) { InternalName = name; Layout = layout; Locale = locale; Engine = engine; Type = type; IsAvailable = true; OperatingSystem = Environment.OSVersion.Platform; InputLanguage = language; }
/// <summary> /// Initializes a new instance of the /// <see cref="T:Palaso.UI.WindowsForms.Keyboard.KeyboardDescription"/> class. /// </summary> internal KeyboardDescription(string name, string layout, string locale, IInputLanguage language, IKeyboardAdaptor engine, KeyboardType type) { InternalName = name; Layout = layout; Locale = locale; Engine = engine; Type = type; IsAvailable = true; OperatingSystem = Environment.OSVersion.Platform; InputLanguage = language; }
/// <summary> /// Gets the keyboard description for the layout of <paramref name="inputLanguage"/>. /// </summary> private static IKeyboardDefinition GetKeyboardDescription(IInputLanguage inputLanguage) { IKeyboardDefinition sameLayout = KeyboardDescription.Zero; IKeyboardDefinition sameCulture = KeyboardDescription.Zero; // TODO: write some tests var requestedLayout = GetLayoutNameEx(inputLanguage.Handle).Name; foreach (KeyboardDescription keyboardDescription in Keyboard.Controller.AllAvailableKeyboards) { 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) { // 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 } } return(sameLayout ?? sameCulture); }
/// <summary> /// Gets the keyboard description for the layout of <paramref name="inputLanguage"/>. /// </summary> internal static KeyboardDescription GetKeyboardDescription(IInputLanguage inputLanguage) { KeyboardDescription sameLayout = null; KeyboardDescription sameCulture = null; // TODO: write some tests 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) { // 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 } } return(sameLayout ?? sameCulture ?? KeyboardController.NullKeyboard); }
public bool TryGetKeyboard(IInputLanguage language, out IKeyboardDefinition keyboard) { return(TryGetKeyboard(language.LayoutName, language.Culture.Name, out keyboard)); }
/// <summary> /// Initializes a new instance of the /// <see cref="T:Palaso.UI.WindowsForms.Keyboard.Linux.XkbKeyboardDescription"/> class. /// </summary> /// <param name='name'>Display name of the keyboard</param> /// <param name='layout'>Name of the keyboard layout</param> /// <param name='locale'>The locale of the keyboard</param> /// <param name='engine'>The keyboard adaptor that will handle this keyboard</param> /// <param name='groupIndex'>The group index of this xkb keyboard</param> internal XkbKeyboardDescription(string name, string layout, string locale, IInputLanguage language, IKeyboardAdaptor engine, int groupIndex) : base(name, layout, locale, language, engine) { GroupIndex = groupIndex; }
public void SetKeyboard(IInputLanguage language) { }
protected void SetInputLanguage(IInputLanguage inputLanguage) { InputLanguage = inputLanguage; }
public void SetInputLanguage(IInputLanguage language) { InputLanguage = language; }
public IKeyboardDefinition GetKeyboard(IInputLanguage language) { throw new NotImplementedException(); }
public IKeyboardDefinition GetKeyboardForInputLanguage(IInputLanguage inputLanguage) { return GetKeyboardDescription(inputLanguage); }
/// <summary/> public KeyboardDescription GetKeyboardForInputLanguage(IInputLanguage inputLanguage) { return(null); }
public bool TryGetKeyboard(IInputLanguage language, out IKeyboardDefinition keyboard) { // NOTE: on Windows InputLanguage.LayoutName returns a wrong name in some cases. // Therefore we need this overload so that we can identify the keyboard correctly. keyboard = _keyboards.FirstOrDefault(kd => kd.InputLanguage != null && kd.InputLanguage.Equals(language)); return keyboard != null; }
/// <summary> /// Initializes a new instance of the /// <see cref="T:Palaso.UI.WindowsForms.Keyboard.KeyboardDescription"/> class. /// </summary> internal KeyboardDescription(string name, string layout, string locale, IInputLanguage language, IKeyboardAdaptor engine) : this(name, layout, locale, language, engine, KeyboardType.System) { }
public IKeyboardDefinition GetKeyboardForInputLanguage(IInputLanguage inputLanguage) { throw new NotImplementedException("Keyman keyboards that are not associated with a language cannot be looked up by language."); }
private void Initialize(string displayName, WinKeyboardAdaptor.LayoutName layoutName, string locale, IInputLanguage inputLanguage) { ConversionMode = (int)(Win32.IME_CMODE.NATIVE | Win32.IME_CMODE.SYMBOL); InternalName = GetDisplayName(displayName, layoutName.Name); InternalLocalizedName = GetDisplayName(displayName, layoutName.LocalizedName); Layout = layoutName.Name; Locale = locale; SetInputLanguage(inputLanguage); }
private KeyboardDescription GetKeyboardForInputLanguage(IInputLanguage inputLanguage) { return(GetKeyboardDescription(inputLanguage)); }
public IKeyboardDefinition GetKeyboard(IInputLanguage language) { return(TrivialKeyboard); }
private KeyboardDescription GetKeyboardForInputLanguage(IInputLanguage inputLanguage) { return GetKeyboardDescription(inputLanguage); }
public IKeyboardDefinition GetKeyboard(IInputLanguage language) { // NOTE: on Windows InputLanguage.LayoutName returns a wrong name in some cases. // Therefore we need this overload so that we can identify the keyboard correctly. return Keyboards .Where(keyboard => keyboard is KeyboardDescription && ((KeyboardDescription)keyboard).InputLanguage != null && ((KeyboardDescription)keyboard).InputLanguage.Equals(language)) .DefaultIfEmpty(KeyboardDescription.Zero) .First(); }
public bool TryGetKeyboard(IInputLanguage language, out IKeyboardDefinition keyboard) { return TryGetKeyboard(language.LayoutName, language.Culture.Name, out keyboard); }
public void SetKeyboard(IInputLanguage language) { SetKeyboard(GetKeyboard(language)); }
public IKeyboardDefinition GetKeyboard(IInputLanguage language) { return TrivialKeyboard; }
public IKeyboardDefinition GetKeyboardForInputLanguage(IInputLanguage inputLanguage) { return(GetKeyboardDescription(inputLanguage)); }
public IKeyboardDefinition GetKeyboardForInputLanguage(IInputLanguage inputLanguage) { throw new NotImplementedException(); }
/// <summary> /// Gets the keyboard description for the layout of <paramref name="inputLanguage"/>. /// </summary> private static KeyboardDescription GetKeyboardDescription(IInputLanguage inputLanguage) { KeyboardDescription sameLayout = null; KeyboardDescription sameCulture = null; // TODO: write some tests var requestedLayout = GetLayoutNameEx(inputLanguage.Handle).Name; foreach (KeyboardDescription keyboardDescription in Keyboard.Controller.AllAvailableKeyboards) { 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) { // 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 } } return sameLayout ?? sameCulture; }