aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Helpers/TouchHelper.cs
blob: 4247f37e9255779e34914ad811b20a94e456b121 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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);

        /// <summary>
        /// Determines whether the current machine is touch enabled.
        /// </summary>
        public static bool IsTouchEnabled()
        {
            foreach (TabletDevice tabletDevice in Tablet.TabletDevices)
            {
                if (tabletDevice.Type == TabletDeviceType.Touch && !String.IsNullOrWhiteSpace(tabletDevice.Name))
                    return true;
            }

            return false;
        }
    }
}