How to Get the Device Platform in Windows 10 App ?

Published on June 15, 2015 by abundantcode

Filed under Windows

Last modified June 15, 2015

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 6430 times

If you running your App on Windows 10 , you might want to get the device platform from your app for some reasons. If this is the case , you can use the DeviceFamily property defined in the Windows.System.Profile.AnalyticsInfo.VersionInfo class.

Below is the sample code snippet demonstrating the usage of this.

How to Get the Device Platform in Windows 10 App ?

public void DisplayPlatform()
{
    var platformFamily = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
    MessageDialog dialog = new MessageDialog(platformFamily);
    dialog.ShowAsync();
}

image

The complete codebehind file is below.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409

namespace Win10App
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
            DisplayPlatform();
        }
        public void DisplayPlatform()
        {
            var platformFamily = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
            MessageDialog dialog = new MessageDialog(platformFamily);
            dialog.ShowAsync();
        }
    }
}

Leave a Comment


x

You might be Interested in these Posts

How to get the AM or PM value from a DateTime object in C# ?

There are times when you might want to get only the string AM or PM from the DateTime object that yo...

C# Program to swap two numbers without using temporary variable

Problem Write a program in Visual CSharp to swap two numbers using temporary variable and display t...

C# Program to print the sum of two numbers

Problem Write a program in C# to add two numbers and display the result in copnsole window. How to...