コード例 #1
0
        public void IMEKeyboard_SetNoKeyboard_DisablesKeyboard()
        {
            using (var switcher = new KeyboardSwitcher())
            {
                // Create an input context
                using (var controller = new DummyInputBusController())
                {
                    controller.Focus();
                    var context = GlobalCachedInputContext.InputContext;

                    // Set input method using the first available keyboard
                    if (switcher.IMEKeyboardsCount <= 0)
                    {
                        Console.WriteLine("Warning: Test IMEKeyboard_SetNoKeyboard_DisablesKeyboard unable to run since no iBus keyboards available or no iBus running.");
                        return;                 // Can't test without an iBus engine to use.
                    }
                    switcher.IMEKeyboard = switcher.GetKeyboardName(0);
                    Assert.That(context.IsEnabled(), Is.True, "Keyboard input method should be enabled when set");

                    // Turn off input method
                    switcher.IMEKeyboard = null;
                    Assert.That(context.IsEnabled(), Is.False, "Should have disabled keyboard input method");
                }
            }
        }
コード例 #2
0
        /// <summary/>
        public void Close()
        {
            if (m_KeyboardSwitcher == null)
            {
                return;
            }

            m_KeyboardSwitcher.Dispose();
            m_KeyboardSwitcher = null;
        }
コード例 #3
0
 /// <summary>
 /// Initialize the installed keyboards
 /// </summary>
 public void Initialize()
 {
     m_KeyboardSwitcher = new KeyboardSwitcher();
     InitKeyboards();
 }