diff --git a/Osklib/ComOnScreenKeyboardController.cs b/Osklib/ComOnScreenKeyboardController.cs index 7664cfb..61f1e81 100644 --- a/Osklib/ComOnScreenKeyboardController.cs +++ b/Osklib/ComOnScreenKeyboardController.cs @@ -103,6 +103,7 @@ public override void Show() { StartTabTip(); // on some devices starting TabTip don't show keyboard, on some does ¯\_(ツ)_/¯ + Thread.Sleep(1000); if (!IsOpened()) { ToggleByCom(); diff --git a/Osklib/NewWindows10OnScreenKeyboardController.cs b/Osklib/NewWindows10OnScreenKeyboardController.cs index a60a6b1..b2bbb21 100644 --- a/Osklib/NewWindows10OnScreenKeyboardController.cs +++ b/Osklib/NewWindows10OnScreenKeyboardController.cs @@ -82,7 +82,7 @@ private static void StartTabTip() } } - private static void ShowByCom() + private static void ToggleByCom() { try { @@ -105,16 +105,17 @@ public override void Show() { if (!IsOpened()) { - ShowByCom(); + ToggleByCom(); } } else { StartTabTip(); // on some devices starting TabTip don't show keyboard, on some does ¯\_(ツ)_/¯ + Thread.Sleep(1000); if (!IsOpened()) { - ShowByCom(); + ToggleByCom(); } } } diff --git a/Osklib/Windows10OnScreenKeyboardController.cs b/Osklib/Windows10OnScreenKeyboardController.cs index 0765046..9dbf390 100644 --- a/Osklib/Windows10OnScreenKeyboardController.cs +++ b/Osklib/Windows10OnScreenKeyboardController.cs @@ -49,13 +49,12 @@ private static void StartTabTip() } } - private static void ShowByCom() + private static void ToggleByCom() { ITipInvocation instance = null; try { instance = (ITipInvocation)Activator.CreateInstance(ComTypes.TipInvocationType); - var window = NativeMethods.GetDesktopWindow(); instance.Toggle(NativeMethods.GetDesktopWindow()); } finally @@ -75,16 +74,17 @@ public override void Show() //Console.WriteLine( "Style {0:X8}", style ); if (!NativeMethods.IsWin10OnScreenKeyboardVisible()) { - ShowByCom(); + ToggleByCom(); } } else { StartTabTip(); // on some devices starting TabTip don't show keyboard, on some does ¯\_(ツ)_/¯ + Thread.Sleep(1000); if (!IsOpened()) { - ShowByCom(); + ToggleByCom(); } } } diff --git a/WpfSample/MainWindow.xaml b/WpfSample/MainWindow.xaml index 1c70b52..345dd99 100644 --- a/WpfSample/MainWindow.xaml +++ b/WpfSample/MainWindow.xaml @@ -25,6 +25,8 @@ + + diff --git a/WpfSample/MainWindow.xaml.cs b/WpfSample/MainWindow.xaml.cs index 49e98f0..b058092 100644 --- a/WpfSample/MainWindow.xaml.cs +++ b/WpfSample/MainWindow.xaml.cs @@ -77,5 +77,15 @@ private void MenuItem_Click(object sender, RoutedEventArgs e) wnd.Owner = this; wnd.Show(); } + + private void Show(object sender, RoutedEventArgs e) + { + OnScreenKeyboard.Show(); + } + + private void Hide(object sender, RoutedEventArgs e) + { + OnScreenKeyboard.Close(); + } } }