/// <summary> /// Open TabTip /// </summary> public static void Open() { const string TabTipProcessName = "TabTip"; if (EnvironmentEx.GetOSVersion() == OSVersion.Win10) { EnableTabTipOpenInDesctopModeOnWin10(); } if (Process.GetProcessesByName(TabTipProcessName).Count() == 0) { Process.Start(TabTipExecPath); } else { try {//Close Previously opened keyboard if (Process.GetProcessesByName(TabTipProcessName).FirstOrDefault() != null) { Process.GetProcessesByName(TabTipProcessName).FirstOrDefault().Kill(); } } catch //(Access Error) Sometime it gives Access Problem { } Task.Yield(); // wait for it to close the keyboard Process.Start(TabTipExecPath); } //MessageBox.Show(value.HasValue ? value.Value.ToString() : "null"); //MessageBox.Show(Process.GetProcessesByName(TabTipProcessName).Count().ToString()); }
/// <summary> /// Automate TabTip for given UIElement. /// Keyboard opens and closes on GotFocusEvent and LostFocusEvent respectively. /// </summary> /// <typeparam name="T"></typeparam> public static void BindTo <T>() where T : UIElement { if (EnvironmentEx.GetOSVersion() == OSVersion.Win7) { return; } if (BindedUIElements.Contains(typeof(T))) { return; } EventManager.RegisterClassHandler( classType: typeof(T), routedEvent: UIElement.GotFocusEvent, handler: new RoutedEventHandler((s, e) => FocusSubject.OnNext(new Tuple <UIElement, bool>((UIElement)s, true))), handledEventsToo: true); EventManager.RegisterClassHandler( classType: typeof(T), routedEvent: UIElement.LostFocusEvent, handler: new RoutedEventHandler((s, e) => FocusSubject.OnNext(new Tuple <UIElement, bool>((UIElement)s, false))), handledEventsToo: true); BindedUIElements.Add(typeof(T)); }
/// <summary> /// Open TabTip /// </summary> public static void Open() { string dotnetVersion = AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName; if (EnvironmentEx.GetOSVersion() == OSVersion.Win10) { EnableTabTipOpenInDesctopModeOnWin10(); } if (!string.IsNullOrEmpty(dotnetVersion) && dotnetVersion.Contains("NETCoreApp")) { var psi = new ProcessStartInfo { FileName = "cmd.exe", Arguments = $"/c \"{TabTipExecPath}\"", CreateNoWindow = true, UseShellExecute = false, }; // *** Redirect the output *** psi.RedirectStandardError = true; psi.RedirectStandardOutput = true; Process.Start(psi); } else { Process.Start(TabTipExecPath); } }
/// <summary> /// Open TabTip /// </summary> public static void Open() { if (EnvironmentEx.GetOSVersion() == OSVersion.Win10) { EnableTabTipOpenInDesctopModeOnWin10(); } Process.Start(TabTipExecPath); }
static TabTipAutomation() { if (EnvironmentEx.GetOSVersion() == OSVersion.Win7) { return; } TabTip.Closed += () => TabTipClosedSubject.OnNext(true); AutomateTabTipOpen(FocusSubject.AsObservable()); AutomateTabTipClose(FocusSubject.AsObservable(), TabTipClosedSubject); }
static TabTipAutomation() { if (EnvironmentEx.GetOSVersion() == OSVersion.Win7) { return; } TabTip.Closed += () => TabTipClosedSubject.OnNext(true); AutomateTabTipOpen(FocusSubject.AsObservable()); AutomateTabTipClose(FocusSubject.AsObservable(), TabTipClosedSubject); AnimationHelper.ExceptionCatched += exception => ExceptionCatched?.Invoke(exception); }