Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to let my c# wpf program know if the user has a touchscreen or not?

I've got an login application that has a swipe system that people only can use when they have a touchscreen. They can login by swiping their personal pattern swipe code.

Is it possible to check in C# or WPF if the user has a touchscreen? Even when he isn't using touch on it at that time?

like image 350
KDP Avatar asked Apr 15 '11 07:04

KDP


People also ask

Are C-sections painful?

You won't feel any pain during the C-section, although you may feel sensations like pulling and pressure. Most women are awake and simply numbed from the waist down using regional anesthesia (an epidural and/or a spinal block) during a C-section. That way, they are awake to see and hear their baby being born.

Are C-sections safer?

Which is safer: vaginal birth or C-section? Vaginal birth is much safer than a C-section for most women and babies. Sometimes a C-section is the only safe option, like when the baby is positioned side-to-side in the belly (transverse lie) or the placenta is covering the cervix (placenta previa).

Does walking prevent C-section?

Does Walking and Exercise Prevent C-Sections? According to a study published in the British Journal of Sports Medicine, women who participated in moderate exercise during pregnancy were 34% less likely to have a cesarean delivery than their non-exercising counterparts.


1 Answers

Within C# code to find out if a touch screen exists (doesn't check if its a single or multi-touch device though) by the using System.Windows.Input namespace in PresentationCore.

    public bool HasTouchInput()
    {
        foreach (TabletDevice tabletDevice in Tablet.TabletDevices)
        {
            //Only detect if it is a touch Screen not how many touches (i.e. Single touch or Multi-touch)
            if(tabletDevice.Type == TabletDeviceType.Touch)
                return true;
        }

        return false;
    }
like image 72
Jason Horrocks Avatar answered Oct 12 '22 11:10

Jason Horrocks