using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Input; namespace Tango.Touch.Helpers { public static class TouchHelper { [DllImport("user32.dll")] private static extern int GetSystemMetrics(int nIndex); /// /// Determines whether the current machine is touch enabled. /// public static bool IsTouchEnabled() { const int MAXTOUCHES_INDEX = 95; int maxTouches = GetSystemMetrics(MAXTOUCHES_INDEX); if (maxTouches > 0) { return true; } foreach (TabletDevice tabletDevice in Tablet.TabletDevices) { if (tabletDevice.Type == TabletDeviceType.Touch && !String.IsNullOrWhiteSpace(tabletDevice.Name)) return true; } return false; } } }