示例#1
0
 /// <summary>
 /// 格式化磁盘
 /// </summary>
 /// <param name="deviceId"></param>
 public void FormatDevice()
 {
     CanFormat  = false;
     FormatText = "正在格式化";
     _eventAggregator.GetEvent <InfoEventArgs>().Publish("正在格式化磁盘...\n");
     Task.Run(() =>
     {
         var ret = SDKApi.EagleControl_ReformatDisk(DeviceId);
         if (ret == 0)
         {
             _eventAggregator.GetEvent <InfoEventArgs>().Publish("正在初始化磁盘...\n");
         }
         else
         {
             _eventAggregator.GetEvent <InfoEventArgs>().Publish("正在格式化磁盘出错...\n");
             MessageBox.Show(string.Format("格式化出现异常:{0}!", ret));
             FormatText = "格式化存储";
             CanFormat  = true;
             return;
         }
         var result = SDKApi.EagleControl_ReinitDisk(DeviceId);
         if (result == 0)
         {
             _eventAggregator.GetEvent <InfoEventArgs>().Publish("已成功初始化磁盘!\n");
         }
         else
         {
             _eventAggregator.GetEvent <InfoEventArgs>().Publish("初始化磁盘异常!\n");
         }
         FormatText = "格式化存储";
         CanFormat  = true;
         MessageBox.Show("格式化完成!");
     });
 }