private WinKeyboardDescription(TfInputProcessorProfile profile, ushort langId, IntPtr hkl, IKeyboardAdaptor engine)
            : base(engine, KeyboardType.System)
        {
            var winEngine = engine as WinKeyboardAdaptor;
            Debug.Assert(winEngine != null);

            InputProcessorProfile = profile;

            var culture = new CultureInfo(langId);
            string locale;
            string cultureName;
            try
            {
                cultureName = culture.DisplayName;
                locale = culture.Name;
            }
            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
                cultureName = "[Unknown Language]";
                locale = "en-US";
            }
            WinKeyboardAdaptor.LayoutName layoutName;
            if (profile.Hkl == IntPtr.Zero && profile.ProfileType != TfProfileType.Illegal)
            {
                layoutName = new WinKeyboardAdaptor.LayoutName(winEngine.ProcessorProfiles.GetLanguageProfileDescription(
                    ref profile.ClsId, profile.LangId, ref profile.GuidProfile));
            }
            else
                layoutName = WinKeyboardAdaptor.GetLayoutNameEx(hkl);

            Initialize(cultureName, layoutName, locale,
                new InputLanguageWrapper(culture, hkl, layoutName.Name));
        }
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="T:Palaso.UI.WindowsForms.Keyboard.Windows.WinKeyboardDescription"/> class.
 /// </summary>
 public WinKeyboardDescription(TfInputProcessorProfile profile, IKeyboardAdaptor engine)
     : this(profile, profile.LangId, profile.Hkl, engine)
 {
 }
Пример #3
0
		private static bool InputProcessorProfilesEqual(TfInputProcessorProfile profile1, TfInputProcessorProfile profile2)
		{
			// Don't compare Flags - they can be different and it's still the same profile
			return profile1.ProfileType == profile2.ProfileType &&
				profile1.LangId == profile2.LangId &&
				profile1.ClsId == profile2.ClsId &&
				profile1.GuidProfile == profile2.GuidProfile &&
				profile1.CatId == profile2.CatId &&
				profile1.HklSubstitute == profile2.HklSubstitute &&
				profile1.Caps == profile2.Caps &&
				profile1.Hkl == profile2.Hkl;
		}