private async void OnReadDma(object obj) { IsStart = true; BtnIsEnabled = false; var findItem = _deviceChannelModels.FirstOrDefault(O => O.IsOpen == true); if (findItem == null) { MessageBox.Show("请打开设备通道!"); BtnIsEnabled = true; IsStart = false; return; } if (string.IsNullOrEmpty(SelectedDsik)) { MessageBox.Show("请选择存储盘符!"); BtnIsEnabled = true; IsStart = false; return; } int dma = 16; var dmaSize = SelectedDMA.Content.ToString(); int.TryParse(dmaSize.TrimEnd('K'), out dma); var result = await _hcdzClient.OnReadDma(SelectedDsik, dma, 0); Thread.Sleep(1); var result2 = await _hcdzClient.OnReadDma(SelectedDsik, dma, 1); if (result2.Contains("内存") || result.Contains("内存")) { MessageBox.Show("分配内存失败,请重新连接设备!"); OpenDeviceText = "连接设备"; IsOpen = false; IsStart = false; } }