private async void OnOpenDevice(object obj) { if (!IsOpen) { var result = await _hcdzClient.DeviceOpen(0); if (result) { BtnIsEnabled = true; OpenDeviceText = "关闭设备"; IsOpen = true; DeviceDesc = await _hcdzClient.InitDeviceInfo(0); } else { RadDesktopAlertManager desktop = new RadDesktopAlertManager(AlertScreenPosition.BottomCenter); desktop.ShowAlert(new RadDesktopAlert() { Content = "设备连接失败!" }); } } else { var flag = await _hcdzClient.DeviceClose(0); if (flag) { OpenDeviceText = "连接设备"; IsOpen = false; DeviceDesc = string.Empty; } else { RadDesktopAlertManager desktop = new RadDesktopAlertManager(AlertScreenPosition.BottomCenter); desktop.ShowAlert(new RadDesktopAlert() { Content = "设备断开失败!" }); } CloseDMAChannel(); } }