• <bdo id='4HN6A'></bdo><ul id='4HN6A'></ul>
  • <small id='4HN6A'></small><noframes id='4HN6A'>

    <tfoot id='4HN6A'></tfoot>

      <legend id='4HN6A'><style id='4HN6A'><dir id='4HN6A'><q id='4HN6A'></q></dir></style></legend>
    1. <i id='4HN6A'><tr id='4HN6A'><dt id='4HN6A'><q id='4HN6A'><span id='4HN6A'><b id='4HN6A'><form id='4HN6A'><ins id='4HN6A'></ins><ul id='4HN6A'></ul><sub id='4HN6A'></sub></form><legend id='4HN6A'></legend><bdo id='4HN6A'><pre id='4HN6A'><center id='4HN6A'></center></pre></bdo></b><th id='4HN6A'></th></span></q></dt></tr></i><div id='4HN6A'><tfoot id='4HN6A'></tfoot><dl id='4HN6A'><fieldset id='4HN6A'></fieldset></dl></div>

        如何在 Windows 10 Universal 中获取设备的唯一标识符?

        时间:2023-09-15

        • <i id='I5QHq'><tr id='I5QHq'><dt id='I5QHq'><q id='I5QHq'><span id='I5QHq'><b id='I5QHq'><form id='I5QHq'><ins id='I5QHq'></ins><ul id='I5QHq'></ul><sub id='I5QHq'></sub></form><legend id='I5QHq'></legend><bdo id='I5QHq'><pre id='I5QHq'><center id='I5QHq'></center></pre></bdo></b><th id='I5QHq'></th></span></q></dt></tr></i><div id='I5QHq'><tfoot id='I5QHq'></tfoot><dl id='I5QHq'><fieldset id='I5QHq'></fieldset></dl></div>
          <legend id='I5QHq'><style id='I5QHq'><dir id='I5QHq'><q id='I5QHq'></q></dir></style></legend>

          <small id='I5QHq'></small><noframes id='I5QHq'>

          <tfoot id='I5QHq'></tfoot>
              <tbody id='I5QHq'></tbody>

            • <bdo id='I5QHq'></bdo><ul id='I5QHq'></ul>

                1. 本文介绍了如何在 Windows 10 Universal 中获取设备的唯一标识符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这是我为 Windows Universal 8.1 获取唯一设备 ID 的旧实现,但 HardwareIdentification 类型不再存在.

                  This is my old implementation to get a Unique DeviceID for Windows Universal 8.1 but the type HardwareIdentification does not exist anymore.

                      private static string GetId()
                      {
                          var token = HardwareIdentification.GetPackageSpecificToken(null);
                          var hardwareId = token.Id;
                          var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);
                  
                          byte[] bytes = new byte[hardwareId.Length];
                          dataReader.ReadBytes(bytes);
                  
                          return BitConverter.ToString(bytes).Replace("-", "");
                      }
                  

                  推荐答案

                  这就是Windows桌面的完整解决方案:

                  That is the complete solution for Windows Desktop:

                  • 添加扩展参考UWP 的 Windows 桌面扩展",如 Peter Torr - 提到的 MSFT.

                  使用此代码获取 HardwareId:

                  Use this Code to get the HardwareId:

                  using System;
                  using Windows.Security.ExchangeActiveSyncProvisioning;
                  using Windows.System.Profile;
                  
                  namespace Tobit.Software.Device
                  {
                      public sealed class DeviceInfo
                      {
                          private static DeviceInfo _Instance;
                          public static DeviceInfo Instance
                          {
                              get {
                                  if (_Instance == null)
                                      _Instance = new DeviceInfo();
                                  return _Instance; }
                  
                          }
                  
                          public string Id { get; private set; }
                          public string Model { get; private set; }
                          public string Manufracturer { get; private set; }
                          public string Name { get; private set; }
                          public static string OSName { get; set; }
                  
                          private DeviceInfo()
                          {
                              Id = GetId();
                              var deviceInformation = new EasClientDeviceInformation();
                              Model = deviceInformation.SystemProductName;
                              Manufracturer = deviceInformation.SystemManufacturer;
                              Name = deviceInformation.FriendlyName;
                              OSName = deviceInformation.OperatingSystem;
                          }
                  
                          private static string GetId()
                          {
                              if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.System.Profile.HardwareIdentification"))
                              {
                                  var token = HardwareIdentification.GetPackageSpecificToken(null);
                                  var hardwareId = token.Id;
                                  var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);
                  
                                  byte[] bytes = new byte[hardwareId.Length];
                                  dataReader.ReadBytes(bytes);
                  
                                  return BitConverter.ToString(bytes).Replace("-", "");
                              }
                  
                              throw new Exception("NO API FOR DEVICE ID PRESENT!");
                          }
                      }
                  }
                  

                  这篇关于如何在 Windows 10 Universal 中获取设备的唯一标识符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Windows 10 ScrollIntoView() 没有滚动到列表视图中间的项目 下一篇:自适应触发器和数据模板

                  相关文章

                  <legend id='SaPNq'><style id='SaPNq'><dir id='SaPNq'><q id='SaPNq'></q></dir></style></legend>
                2. <i id='SaPNq'><tr id='SaPNq'><dt id='SaPNq'><q id='SaPNq'><span id='SaPNq'><b id='SaPNq'><form id='SaPNq'><ins id='SaPNq'></ins><ul id='SaPNq'></ul><sub id='SaPNq'></sub></form><legend id='SaPNq'></legend><bdo id='SaPNq'><pre id='SaPNq'><center id='SaPNq'></center></pre></bdo></b><th id='SaPNq'></th></span></q></dt></tr></i><div id='SaPNq'><tfoot id='SaPNq'></tfoot><dl id='SaPNq'><fieldset id='SaPNq'></fieldset></dl></div>
                    <bdo id='SaPNq'></bdo><ul id='SaPNq'></ul>
                      <tfoot id='SaPNq'></tfoot>

                      <small id='SaPNq'></small><noframes id='SaPNq'>