wpf:

 <phone:PhoneApplicationPage
x:Class="ABSystemInfo.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True"> <!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<!--Pivot Control-->
<controls:Pivot Title="DEVICE INFO">
<controls:PivotItem Header="device">
<Grid>
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Height="607" Width="456">
<TextBlock Text="Device Manufacturer" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="DeviceManufacturerTextBlock" FontSize="36" TextAlignment="Center"/>
<TextBlock Text="Device Name" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="DeviceNameTextBlock" FontSize="36" TextAlignment="Center"/>
<TextBlock Text="Device Firmware Version" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="DeviceFirmwareVersionTextBlock" FontSize="36" TextAlignment="Center"/>
<TextBlock Text="Device Hardware Version" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="DeviceHardwareVersionTextBlock" FontSize="36" TextAlignment="Center"/>
</StackPanel> </Grid>
</controls:PivotItem> <controls:PivotItem Header="memory">
<Grid>
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Height="607" Width="456">
<TextBlock Text="Application Current Memory Usage" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="ApplicationCurrentMemoryUsageTextBlock" FontSize="36" TextAlignment="Center"/>
<TextBlock Text="Application Memory Usage Limit" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="ApplicationMemoryUsageLimitTextBlock" FontSize="36" TextAlignment="Center"/>
<TextBlock Text="Application Peak Memory Usage" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="ApplicationPeakMemoryUsageTextBlock" FontSize="36" TextAlignment="Center"/>
<TextBlock Text="DeviceTotalMemory" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="DeviceTotalMemoryTextBlock" FontSize="36" TextAlignment="Center"/> </StackPanel>
</Grid>
</controls:PivotItem> <controls:PivotItem Header="hardware">
<Grid>
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Height="607" Width="456">
<TextBlock Text="Is Keyboard Deployed?" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="IsKeyboardDeployedTextBlock" FontSize="36" TextAlignment="Center"/>
<TextBlock Text="Is Keyboard Present?" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="IsKeyboardPresentTextBlock" FontSize="36" TextAlignment="Center"/>
<TextBlock Text="Power Source" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="PowerSourceTextBlock" FontSize="36" TextAlignment="Center"/>
</StackPanel>
</Grid>
</controls:PivotItem> <controls:PivotItem Header="os">
<Grid>
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Height="607" Width="456">
<TextBlock Text="Operating System" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="OperatingSystemPlatformTextBlock" FontSize="36" TextAlignment="Center"/>
<TextBlock Text="Version" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="OperatingSystemVersionTextBlock" FontSize="36" TextAlignment="Center"/>
</StackPanel>
</Grid>
</controls:PivotItem> <controls:PivotItem Header="clr">
<Grid>
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Height="607" Width="456">
<TextBlock Text="Major" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="ClrMajorTextBlock" FontSize="36" TextAlignment="Center"/>
<TextBlock Text="Minor" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="ClrMinorTextBlock" FontSize="36" TextAlignment="Center"/>
<TextBlock Text="Revision" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="ClrRevisionTextBlock" FontSize="36" TextAlignment="Center"/>
<TextBlock Text="Build" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="ClrBuildTextBlock" FontSize="36" TextAlignment="Center"/>
</StackPanel>
</Grid>
</controls:PivotItem> <controls:PivotItem Header="unique ids">
<Grid>
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Height="607" Width="456">
<TextBlock Text="Device Unique ID" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="DeviceUniqueIDTextBlock" FontSize="36" TextAlignment="Center" TextWrapping="Wrap"/>
<TextBlock Text="Windows Live Anonymous ID" Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/>
<TextBlock Text="0" Margin="10" Name="WindowsLiveAnonymousIDTextBlock" FontSize="36" TextAlignment="Center" TextWrapping="Wrap"/>
</StackPanel>
</Grid>
</controls:PivotItem>
</controls:Pivot>
</Grid>
</phone:PhoneApplicationPage>

MainPage.cs

 using System;
using System.Globalization;
using System.Windows;
using System.Windows.Threading;
using Microsoft.Phone.Info; namespace ABSystemInfo
{
public partial class MainPage
{
readonly DispatcherTimer _timer; private long _applicationCurrentMemoryUsage;
private long _applicationMemoryUsageLimit;
private long _applicationPeakMemoryUsage;
private long _deviceTotalMemory; private const int AnidLength = ;
private const int AnidOffset = ; public MainPage()
{
InitializeComponent();
LoadStaticInfo();
_timer = new DispatcherTimer();
_timer.Interval = new TimeSpan(, , );
_timer.Tick += TimerTick;
_timer.Start(); } void TimerTick(object sender, EventArgs e)
{
try
{
_applicationCurrentMemoryUsage = DeviceStatus.ApplicationCurrentMemoryUsage;
_applicationMemoryUsageLimit = DeviceStatus.ApplicationMemoryUsageLimit;
_applicationPeakMemoryUsage = DeviceStatus.ApplicationPeakMemoryUsage; _deviceTotalMemory = DeviceStatus.DeviceTotalMemory; ApplicationCurrentMemoryUsageTextBlock.Text = String.Format("{0} MB ({1} KB)", ((_applicationCurrentMemoryUsage / ) / ), (_applicationCurrentMemoryUsage / ));
ApplicationMemoryUsageLimitTextBlock.Text = String.Format("{0} MB ({1} KB)", ((_applicationMemoryUsageLimit / ) / ), (_applicationMemoryUsageLimit / ));
ApplicationPeakMemoryUsageTextBlock.Text = String.Format("{0} MB ({1} KB)", ((_applicationPeakMemoryUsage / ) / ), (_applicationPeakMemoryUsage / ));
DeviceTotalMemoryTextBlock.Text = String.Format("{0} MB ({1} KB)", ((_deviceTotalMemory / ) / ), (_deviceTotalMemory / )); IsKeyboardDeployedTextBlock.Text = DeviceStatus.IsKeyboardDeployed.ToString(CultureInfo.InvariantCulture);
IsKeyboardPresentTextBlock.Text = DeviceStatus.IsKeyboardPresent.ToString(CultureInfo.InvariantCulture);
PowerSourceTextBlock.Text = DeviceStatus.PowerSource.ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} private void LoadStaticInfo()
{
DeviceFirmwareVersionTextBlock.Text = DeviceStatus.DeviceFirmwareVersion;
DeviceHardwareVersionTextBlock.Text = DeviceStatus.DeviceHardwareVersion;
DeviceManufacturerTextBlock.Text = DeviceStatus.DeviceManufacturer;
DeviceNameTextBlock.Text = DeviceStatus.DeviceName; OperatingSystemPlatformTextBlock.Text = Environment.OSVersion.Platform.ToString();
OperatingSystemVersionTextBlock.Text = Environment.OSVersion.Version.ToString(); ClrBuildTextBlock.Text = Environment.Version.Build.ToString(CultureInfo.InvariantCulture);
ClrMajorTextBlock.Text = Environment.Version.Major.ToString(CultureInfo.InvariantCulture);
ClrMinorTextBlock.Text = Environment.Version.Minor.ToString(CultureInfo.InvariantCulture);
ClrRevisionTextBlock.Text = Environment.Version.Revision.ToString(CultureInfo.InvariantCulture); string deviceUniqueId = String.Empty;
for (int i = ; i < GetDeviceUniqueId().GetLength(); i++)
{
deviceUniqueId += GetDeviceUniqueId().GetValue(i);
} DeviceUniqueIDTextBlock.Text = deviceUniqueId;
WindowsLiveAnonymousIDTextBlock.Text =
GetWindowsLiveAnonymousId().ToString(CultureInfo.InvariantCulture);
} //Note: to get a result requires ID_CAP_IDENTITY_DEVICE
// to be added to the capabilities of the WMAppManifest
// this will then warn users in marketplace public static byte[] GetDeviceUniqueId()
{
byte[] result = null;
object uniqueId;
if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId))
result = (byte[])uniqueId; return result;
} // NOTE: to get a result requires ID_CAP_IDENTITY_USER
// to be added to the capabilities of the WMAppManifest
// this will then warn users in marketplace public static string GetWindowsLiveAnonymousId()
{
string result = String.Empty;
object anid;
if (UserExtendedProperties.TryGetValue("ANID", out anid))
{
if (anid != null && anid.ToString().Length >= (AnidLength + AnidOffset))
{
result = anid.ToString().Substring(AnidOffset, AnidLength);
}
} return result;
}
}
}

获取 Windows Phone 手机系统信息的更多相关文章

  1. 使用C#获取Windows Phone手机的各种数据(转)

    转自:http://www.sum16.com/desinger/use-c-sharp-get-windows-phone-information.html 使用C#获取Windows Phone手 ...

  2. python使用wmi模块获取windows下的系统信息监控系统-乾颐堂

    Python用WMI模块获取Windows系统的硬件信息:硬盘分区.使用情况,内存大小,CPU型号,当前运行的进程,自启动程序及位置,系统的版本等信息. 本文实例讲述了python使用wmi模块获取w ...

  3. 几个获取Windows系统信息的Delphi程序

    1.获取windows版本信息 可以通过Windows API函数GetVersionEx来获得. 具体程序如下: Procedure Tform1.Button1Click(sender:TObje ...

  4. 通过PowerShell获取Windows系统密码Hash

    当你拿到了系统控制权之后如何才能更长的时间内控制已经拿到这台机器呢?作为白帽子,已经在对手防线上撕开一个口子,如果你需要进一步扩大战果,你首先需要做的就是潜伏下来,收集更多的信息便于你判断,便于有更大 ...

  5. js获取客户端计算机硬件及系统信息

    注意:(1):遇到“automation服务器不能创建对象”的问题 解决方案: 1.在“运行”中执行regsvr32 scrrun.dll 2.安全模式设置成“中”,如果javascript脚本中报这 ...

  6. [C语言](二)01 获取Windows图形构件大小信息

    SYSMETS.c #include <windows.h> #include "SYSMETS.H"//自定义的单元,所以用"",不是用<& ...

  7. 获取WINDOWS特殊文件夹

    const// registry entries for special paths are kept in :  REGSTR_PATH_SPECIAL_FOLDERS   = REGSTR_PAT ...

  8. VC++ 获取windows系统的版本类型

    vc中获取windows版本信息,一般是调用GetVersionEx 这个API函数来获取的,这个API需要OSVERSIONINFOEX 这个结构体作为参数,OSVERSIONINFOEX 的对应的 ...

  9. qt 获取windows 的消息(通过MFC的DLL的透明窗体转发消息)good

    qt 给win32 发送消息很简单,但是要获取windows 消息却十分复杂,最后想了一个不是很完美 但是也是以现在本人能力所能实现的唯一途径了,基本原理是 利用vc编写一个mfc 的dll ,这个d ...

随机推荐

  1. mediawiki的安装与配置

    apache的配置: 1. 开启php module 查看mods-enabled/php5.load 是否存在,不存在的话, 就从mods-avaliable中复制一个到mods-enabled中. ...

  2. 将w3cplus网站中的文章页面提取并导出为pdf文档

    最近在看一些关于CSS3方面的知识,主要是平时看到网页中有很多用CSS3实现的很炫的效果,所以就打算系统的学习一下.在网上找到很多的文章,但都没有一个好的整理性,比较凌乱.昨天看到w3cplus网站中 ...

  3. Xcode真机调试中"There was an internal API error"错误解决方法

    xcode7更新之后使用真机调试,在IOS8的一台iphone6也没问题.IOS9.2的一台iphone6s也没问题.但是在IOS7.0的一台iPhone4s上面在最后安装的时候居然安装失败,提示 T ...

  4. leetCode191/201/202/136 -Number of 1 Bits/Bitwise AND of Numbers Range/Happy Number/Single Number

    一:Number of 1 Bits 题目: Write a function that takes an unsigned integer and returns the number of '1' ...

  5. GPS accuracy in Android

    Get the estimated accuracy of this location, in meters. We define accuracy as the radius of 68% conf ...

  6. java生成解析xml的另外两种方法Xstream

    Xstream生成和解析xm和JAXB生成和解析xml的方法. 一,Xstream Xstream非jdk自带的,需要到入Xstream-1.4.3.jar和xpp3_min-1.1.4.jar 1. ...

  7. ubuntu14.04LTS安装vmware10.0.1

    因为所用Ubuntu系统是32位,而VMware最新版本又不支持32位,只好下载以前版本vmware10.0.1. vmware10.0.1下载地址:  http://down.it168.com/1 ...

  8. CSS - Transform(Translate) abnormal shadow in firefox

    问题:当在Firefox中实现动画translate时,会出现虚影的状况: 经查找相关的解决方法,父容器添加样式:outline: 1px solid transparent;//即可解决问题. 但不 ...

  9. Factorization Machine

    Factorization Machine Model 如果仅考虑两个样本间的交互, 则factorization machine的公式为: $\hat{y}(\mathbf{x}):=w_0 + \ ...

  10. BZOJ 1001 [BeiJing2006] 狼抓兔子(平面图最大流)

    题目大意 现在小朋友们最喜欢的"喜羊羊与灰太狼",话说灰太狼抓羊不到,但抓兔子还是比较在行的.而且现在的兔子还比较笨,它们只有两个窝,现在你做为狼王,面对下面这样一个网格的地形: ...