private KeymanVersion GetInstalledKeymanVersion() { #if !MONO // limit the COMException catching by determining the current version once and assuming it for the // rest of the adaptor's lifetime try { var keyman10 = new KeymanClass(); return(KeymanVersion.Keyman10); } catch (COMException) { // not 10 } try { var keyman = new TavultesoftKeymanClass(); return(KeymanVersion.Keyman7to9); } catch (COMException) { // Not 7-9 } try { var keymanLink = new KeymanLink.KeymanLink(); return(KeymanVersion.Keyman6); } catch (COMException) { } #endif return(KeymanVersion.NotInstalled); }
public Action GetKeyboardSetupAction() { switch (InstalledKeymanVersion) { #if !MONO case KeymanVersion.Keyman10: return(() => { var keymanClass = new KeymanClass(); keymanClass.Control.OpenConfiguration(); }); case KeymanVersion.Keyman7to9: case KeymanVersion.Keyman6: return(() => { string args; var setupApp = GetKeyboardSetupApplication(out args); Process.Start(setupApp, args); }); #endif default: throw new NotSupportedException($"No keyboard setup action defined for keyman version {InstalledKeymanVersion}"); } }
private static bool IsKeymanKeyboard(string cultureName) { #if !MONO try { var kmn = new KeymanClass(); foreach (IKeymanLanguage kl in kmn.Languages) { foreach (IKeymanKeyboard kb in kmn.Keyboards) { if (kb.DefaultWindowsLanguages != null && kb.DefaultWindowsLanguages.Contains(cultureName)) { return(true); } } } } catch (COMException) { // Not a keyman keyboard } #endif return(false); }