zoukankan      html  css  js  c++  java
  • Windows Phone 设备信息

      在进行Windows Phone开发的过程中,我们会需要获取手机的一些相关信息,如下列出如何获取手机的一些常用信息。

      一.设备屏幕信息
        double width = Application.Current.Host.Content.ActualWidth;
        double heigth = Application.Current.Host.Content.ActualHeight;

      二.设备信息相关(Microsoft.Phone.Info)
        
    1.设备厂商
        
    string DeviceManufacturer = DeviceStatus.DeviceManufacturer;
        2.设备名称
        
    string DeviceName = DeviceStatus.DeviceName;
        3.设备ID
        byte[] result = null;
        object uniqueId;
        if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId))
        {
          result = (byte[])uniqueId;
        }
        //转换设备ID为字符串
        string DeviceUniqueId = Convert.ToBase64String(result);
        4.固件版本
        
    string DeviceFirmwareVersion = DeviceStatus.DeviceFirmwareVersion;
        5.硬件版本
        
    string DeviceHardwareVersion = DeviceStatus.DeviceHardwareVersion;
        6.总内存
        
    long DeviceTotalMemory = DeviceStatus.DeviceTotalMemory;
        7.应用程序当前使用内存
        
    long ApplicationCurrentMemoryUsage = DeviceStatus.ApplicationCurrentMemoryUsage;
        8.应用程序使用内存峰值
        
    long ApplicationPeakMemoryUsage = DeviceStatus.ApplicationPeakMemoryUsage;
        9.操作系统版本
        String osversion= System.Environment.OSVersion.Version.ToString(); 

      三.网络状态
        
    1. 获取网络是否可用
        
    bool flag = Microsoft.Phone.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();
        2. 获取当前手机联网类型
        
    Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType
        Wireless80211是wifi
        None是没有网络连接
        MobileBroadbandGsm是gsm 2g网络连接
        MobileBroadbandCdma 是CDMA 联通3g
        Ethernet - 连接到电脑上网
        3. 获取当前是否开启网络连接
        
    bool flag = Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.IsNetworkAvailable;
        4. 获取是否开启wifi
        
    bool flag = Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.IsWiFiEnabled;


    转自:http://www.cnblogs.com/huizhang212/archive/2012/03/04/PhoneInfo.html

  • 相关阅读:
    docker进入交互界面
    FCN训练注意事项
    centos7 常用命令
    vim锁定,不能动
    爬虫三之beautifulsoup
    爬虫二之Requests
    爬虫一之基本操作
    MathType的配置问题;将word中的公式转换为mathtype格式失败,缺少OMML2MML.XSL
    神经网络实现Discuz验证码识别
    修改linux环境变量配置文件
  • 原文地址:https://www.cnblogs.com/shanzei/p/2415217.html
Copyright © 2011-2022 走看看