예제 #1
0
        /// <summary>
        /// Produce IBus keyboard identifier which is simular to the actual ibus switcher menu.
        /// </summary>
        internal string FormatKeyboardIdentifier(IBusEngineDesc engineDesc)
        {
            string id           = engineDesc.Language;
            string languageName = string.IsNullOrEmpty(id) ? ResourceHelper.GetResourceString("kstidOtherLanguage") : Icu.GetDisplayName(id);

            return(String.Format("{0} - {1}", languageName, engineDesc.Name));
        }
예제 #2
0
		public IbusKeyboardDescription(IKeyboardSwitchingAdaptor engine, IBusEngineDesc ibusKeyboard,
			uint systemIndex):
			base(FormatKeyboardIdentifier(ibusKeyboard), ibusKeyboard.LongName, ibusKeyboard.Language,
			null, engine, KeyboardType.OtherIm)
		{
			IBusKeyboardEngine = ibusKeyboard;
			SystemIndex = systemIndex;
		}
 /// <summary>
 /// Produce IBus keyboard identifier which is similar to the actual ibus switcher menu.
 /// </summary>
 private static string FormatKeyboardIdentifier(IBusEngineDesc engineDesc)
 {
     string id = engineDesc.Language;
     string languageName = string.IsNullOrEmpty(id) ? OtherLanguage :
         new Locale(id).GetDisplayName(new Locale(Application.CurrentCulture.TwoLetterISOLanguageName));
     if (id != null && id.ToLowerInvariant() == languageName.ToLowerInvariant())
         languageName = OtherLanguage;
     return String.Format("{0} - {1}", languageName, engineDesc.Name);
 }
예제 #4
0
        /// <summary>
        /// Produce IBus keyboard identifier which is similar to the actual ibus switcher menu.
        /// </summary>
        private static string FormatKeyboardIdentifier(IBusEngineDesc engineDesc)
        {
            string id           = engineDesc.Language;
            string languageName = string.IsNullOrEmpty(id) ? OtherLanguage :
                                  new Locale(id).GetDisplayName(new Locale(Application.CurrentCulture.TwoLetterISOLanguageName));

            if (id != null && id.ToLowerInvariant() == languageName.ToLowerInvariant())
            {
                languageName = OtherLanguage;
            }
            return(String.Format("{0} - {1}", languageName, engineDesc.Name));
        }
예제 #5
0
        /// <summary>Get Ibus keyboard at given index</summary>
        public string GetKeyboardName(int index)
        {
            if (Connection == null)
            {
                return(String.Empty);
            }
            var ibusWrapper = new IBusDotNet.InputBusWrapper(Connection);

            object[]       engines    = ibusWrapper.InputBus.ListActiveEngines();
            IBusEngineDesc engineDesc = IBusEngineDesc.GetEngineDesc(engines[index]);

            return(FormatKeyboardIdentifier(engineDesc));
        }
예제 #6
0
        public void CanGetEngineDesc()
        {
            Connection = IBusConnectionFactory.Create();
            if (Connection == null)
            {
                Assert.Ignore("Can't run this test without ibus running.");
                return;
            }

            var ibusWrapper = new IBusDotNet.InputBusWrapper(Connection);

            object[] engines = ibusWrapper.InputBus.ListActiveEngines();
            if (engines.Length == 0)
            {
                Assert.Ignore("Can't run this test without any ibus keyboards installed.");
                return;
            }

            Assert.IsNotNull(IBusEngineDesc.GetEngineDesc(engines[0]));
        }
        public IbusKeyboardDescription(IKeyboardAdaptor engine, IBusEngineDesc ibusKeyboard)
            : base(FormatKeyboardIdentifier(ibusKeyboard), ibusKeyboard.LongName, ibusKeyboard.Language,
			null, engine, KeyboardType.OtherIm)
        {
            IBusKeyboardEngine = ibusKeyboard;
        }
 public IbusKeyboardDescription(string id, IBusEngineDesc ibusKeyboard, IKeyboardSwitchingAdaptor engine)
     : base(id, FormatKeyboardIdentifier(ibusKeyboard.Name, ibusKeyboard.Language), ibusKeyboard.LongName, ibusKeyboard.Language, true, engine)
 {
     IBusKeyboardEngine = ibusKeyboard;
 }
예제 #9
0
 internal IbusKeyboardDescription(IbusKeyboardDescription other) : base(other)
 {
     IBusKeyboardEngine = other.IBusKeyboardEngine;
 }
예제 #10
0
 public IbusKeyboardDescription(IKeyboardAdaptor engine, IBusEngineDesc ibusKeyboard) :
     base(FormatKeyboardIdentifier(ibusKeyboard), ibusKeyboard.LongName, ibusKeyboard.Language,
          null, engine, KeyboardType.OtherIm)
 {
     IBusKeyboardEngine = ibusKeyboard;
 }
예제 #11
0
		public IbusKeyboardDescription(string id, IBusEngineDesc ibusKeyboard, IKeyboardSwitchingAdaptor engine)
			: base(id, FormatKeyboardIdentifier(ibusKeyboard.Name, ibusKeyboard.Language), ibusKeyboard.LongName, ibusKeyboard.Language, true, engine)
		{
			IBusKeyboardEngine = ibusKeyboard;
		}
 public IbusXkbKeyboardDescription(string id, IBusEngineDesc ibusKeyboard, IKeyboardSwitchingAdaptor engine)
     : base(id, ibusKeyboard, engine)
 {
 }