Пример #1
0
        /// <summary>
        /// 获取设备默认DPI
        /// </summary>
        /// <returns></returns>
        public int GetSourceDpi()
        {
            int?result = new DeviceHardwareInfoGetter(Device).GetDpi();

            if (result == null)
            {
                throw new Exception("get dpi failed");
            }
            return((int)result);
        }
Пример #2
0
 public DpiChangeWindow(DeviceBasicInfo devinfo)
 {
     InitializeComponent();
     this.devinfo    = devinfo;
     BtnOK.IsEnabled = true;
     new Thread(() =>
     {
         int?_deviceDefaultDpi = new DeviceHardwareInfoGetter(devinfo.Serial).GetDpi();
         this.Dispatcher.Invoke(() =>
         {
             TextBlockCurrentDpi.Text = (_deviceDefaultDpi == null) ? UIHelper.GetString("GetFail") : _deviceDefaultDpi.ToString();
             TextBoxInput.Text        = (_deviceDefaultDpi == null) ? "" : _deviceDefaultDpi.ToString();
             BtnOK.IsEnabled          = true;
         });
     }).Start();
 }