public WinKeyboardAdaptor() { try { ProcessorProfiles = new TfInputProcessorProfilesClass(); } catch (InvalidCastException) { ProcessorProfiles = null; return; } // ProfileMgr will be null on Windows XP - the interface got introduced in Vista ProfileMgr = ProcessorProfiles as ITfInputProcessorProfileMgr; _tfLanguageProfileNotifySink = new TfLanguageProfileNotifySink(this); TfSource = ProcessorProfiles as ITfSource; if (TfSource != null) { _profileNotifySinkCookie = TfSource.AdviseSink( ref Guids.Consts.ITfLanguageProfileNotifySink, _tfLanguageProfileNotifySink); } if (KeyboardController.Instance != null) { KeyboardController.Instance.ControlAdded += OnControlRegistered; KeyboardController.Instance.ControlRemoving += OnControlRemoving; } }
public WinKeyboardAdaptor() { try { ProcessorProfiles = new TfInputProcessorProfilesClass(); } catch (InvalidCastException) { ProcessorProfiles = null; return; } // ProfileMgr will be null on Windows XP - the interface got introduced in Vista ProfileManager = ProcessorProfiles as ITfInputProcessorProfileMgr; SwitchingAdaptor = new WindowsKeyboardSwitchingAdapter(this); }
public WinKeyboardAdaptor() { try { ProcessorProfiles = new TfInputProcessorProfilesClass(); } catch (InvalidCastException) { ProcessorProfiles = null; return; } // ProfileMgr will be null on Windows XP - the interface got introduced in Vista ProfileMgr = ProcessorProfiles as ITfInputProcessorProfileMgr; _tfLanguageProfileNotifySink = new TfLanguageProfileNotifySink(this); TfSource = ProcessorProfiles as ITfSource; if (TfSource != null) { _profileNotifySinkCookie = TfSource.AdviseSink(Guids.ITfLanguageProfileNotifySink, _tfLanguageProfileNotifySink); } if (KeyboardController.Instance != null) { KeyboardController.Instance.ControlAdded += OnControlRegistered; KeyboardController.Instance.ControlRemoving += OnControlRemoving; } }
private static bool IsUsingInputProcessor() { #if __MonoCS__ // not yet implemented on Linux return false; #else TfInputProcessorProfilesClass inputProcessor; try { inputProcessor = new TfInputProcessorProfilesClass(); } catch (InvalidCastException) { return false; } var profileMgr = inputProcessor as ITfInputProcessorProfileMgr; if (profileMgr == null) return false; var profile = profileMgr.GetActiveProfile(Guids.TfcatTipKeyboard); return profile.ProfileType == TfProfileType.InputProcessor; #endif }