• 获取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;

  • 相关阅读:
    centos下修改hosts文件以及生效命令
    CentOS 7 上安装(LAMP)服务 Linux,Apache,MySQL,PHP
    sqlserver下载地址及密匙
    npm/gulp/nodejs
    sp_addlinkedserver 跨服务器连接数据库查询
    sql使用临时表循环
    nodejs和npm
    扫描输入后自动定位到下一个输入框
    Unable to load the specified metadata resource
    mysql保存乱码(C#)
  • 原文地址:https://www.cnblogs.com/qq278360339/p/2672130.html
Copyright © 2020-2023  润新知