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;
        }
		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
		}
Example #3
0
		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;

			m_tfLanguageProfileNotifySink = new TfLanguageProfileNotifySink(this);

			TfSource = ProcessorProfiles as ITfSource;
			if (TfSource != null)
			{
				m_profileNotifySinkCookie = TfSource.AdviseSink(Guids.ITfLanguageProfileNotifySink,
					m_tfLanguageProfileNotifySink);
			}

			if (KeyboardController.EventProvider != null)
			{
				KeyboardController.EventProvider.ControlAdded += OnControlRegistered;
				KeyboardController.EventProvider.ControlRemoving += OnControlRemoving;
			}
		}