Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine metro app is running in Windows 8 tab or Desktop PC

I am developing app with windows 8 metro style. This app has some more feature if it running in desktop pc compared to Tablet. But my problem is how to detect app is running in PC or Tab. I don't want to release 2 build seperately for PC and TAB.

Please help me. Update: Wheter is it possible to do it with GetSystemMatrics? In the desktop, our app behave like client and server, but in the tab and mobile device it behave like client only

like image 917
Shashi Avatar asked Apr 11 '12 06:04

Shashi


2 Answers

Windows.Devices namespace has a wealth of information about device capabilities. For example to determine if the device is touch enabled, you can use:

var hasTouch = Windows.Devices.Input
                  .PointerDevice.GetPointerDevices()
                  .Any(p => p.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Touch);
like image 148
Yasser Makram Avatar answered Sep 29 '22 09:09

Yasser Makram


@Mahantesh: If it's specifically between Desktop PC & Tablet (excluding laptop), then you can check the "battery properties" such as AC/Battery Supply, Battery remaining etc. which as far as I know are available only for computers running on battery power & certainly Desktop doesn't do that.

In simpler terms, the battery notification is not available for my Desktop PC whereas it's there for my laptop.

like image 34
Viral Jain Avatar answered Sep 29 '22 11:09

Viral Jain