Skip to content

Commit

Permalink
Use hardcoded path to TabTip.exe
Browse files Browse the repository at this point in the history
  • Loading branch information
m.fedotov authored and m.fedotov committed Oct 17, 2016
1 parent 8309a15 commit 65b58e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 26 deletions.
10 changes: 5 additions & 5 deletions WPFTabTip/AnimationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ private static Storyboard CreateMoveRootVisualStoryboard(FrameworkElement visual

private static void SubscribeToWindowStateChangedToMoveRootVisual(FrameworkElement visualRoot)
{
var root = visualRoot as Window;
if (root != null)
// ReSharper disable once CanBeReplacedWithTryCastAndCheckForNull
if (visualRoot is Window)
{
Window window = root;
Window window = (Window)visualRoot;

window.StateChanged += (sender, args) =>
{
Expand Down Expand Up @@ -223,7 +223,7 @@ private static void MoveRootVisualBy(FrameworkElement rootVisual, double moveBy)

if (doubleAnimation != null)
{
var window = rootVisual as Window;
Window window = rootVisual as Window;
if (window != null)
{
doubleAnimation.From = window.Top;
Expand All @@ -247,7 +247,7 @@ private static void MoveRootVisualTo(FrameworkElement rootVisual, double moveTo)

if (doubleAnimation != null)
{
var window = rootVisual as Window;
Window window = rootVisual as Window;
if (window != null)
{
doubleAnimation.From = window.Top;
Expand Down
23 changes: 2 additions & 21 deletions WPFTabTip/TabTip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Microsoft.Win32;
Expand All @@ -12,6 +11,7 @@ namespace WPFTabTip
public static class TabTip
{
private const string TabTipWindowClassName = "IPTip_Main_Window";
private const string TabTipExecPath = @"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe";
private const string TabTipRegistryKeyName = @"HKEY_CURRENT_USER\Software\Microsoft\TabletTip\1.7";

[DllImport("user32.dll")]
Expand Down Expand Up @@ -50,25 +50,6 @@ internal static void OpenUndockedAndStartPoolingForClosedEvent()
StartPoolingForTabTipClosedEvent();
}


private static string _keyboardPath;
private static string KeyboardPath
{
get
{
if (string.IsNullOrEmpty(_keyboardPath))
{
_keyboardPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles),
@"Microsoft Shared\ink\TabTip.exe");
if (!File.Exists(_keyboardPath))
{
// older windows versions
_keyboardPath = Environment.GetFolderPath(Environment.SpecialFolder.System) + @"\osk.exe";
}
}
return _keyboardPath;
}
}
/// <summary>
/// Open TabTip
/// </summary>
Expand All @@ -77,7 +58,7 @@ public static void Open()
if (EnvironmentEx.GetOSVersion() == OSVersion.Win10)
EnableTabTipOpenInDesctopModeOnWin10();

Process.Start(KeyboardPath);
Process.Start(TabTipExecPath);
}

private static void EnableTabTipOpenInDesctopModeOnWin10()
Expand Down

0 comments on commit 65b58e1

Please sign in to comment.