public Window_PeripheralsConfig_VM() { if (!this.IsInDesignMode) { string title = ""; CommonStaticMethod.GetLanguageString("光探头设置", "Lang_Bright_PeripheralSettingTitle", out title); this.WindowRealTitle = title; _peripheralFinder = new PeripheralsFinderAccessor(_globalParams.ServerProxy); } CmdStartFindPeripherals = new RelayCommand<PeripheralsSettingParam>(OnCmdStartFindPeripherals); CmdFastSegmentation = new RelayCommand(OnFastSegmentation); CmdOK = new RelayCommand(OnCmdOK); CmdCancel = new RelayCommand(OnCmdCancel); CmdShowValidError = new RelayCommand<string>(ShowValidError); }
public void ExecuteCommandCallBack(TransferParams param, TransFerParamsDataHandler callback, object userToken) { string userParam = System.Guid.NewGuid().ToString(); try { if (_serverProxy == null || !_serverProxy.IsRegisted) { return; } lock (_lockCallBack) { _dicCallBack.Add(userParam, new OpreateCallBack() { UserToKen = userToken, TransFerParamsCallBack = callback }); } switch (param.TranType) { case TransferType.M3_PeripheralsInfo: _fLogService.Info("开始提供光探头。。。"); PeripheralsFinderAccessor peripherals = new PeripheralsFinderAccessor(_serverProxy); peripherals.ReadAllPeripheralsOnSenderOrPortFuncCard(ReadPeripheralsResultCallback, userParam); break; case TransferType.M3_FunctionCardMonitor: _fLogService.Info("开始提供多功能卡信息。。。"); FunctionCardFinderAccessor funCard = new FunctionCardFinderAccessor(_serverProxy); funCard.ReadAllFunctionCardOnPort(ReadFunctionCardCallBack, userParam); break; case TransferType.M3_ReadSmartLightHWConfig: _fLogService.Info("Read HW Bright Exec..."); if (!_smartLightAccessor.ReadHWSmartLightData(param.Content, 0, ReadSmartLightHWConfigCallBack, userParam)) { ReadSmartLightHWConfigCallBack(new ReadSmartLightDataParams(), userParam); } _fLogService.Info("Read HW Bright Finish..."); break; case TransferType.M3_BlackScreen: //TODO:黑屏 string commPort1 = string.Empty; ILEDDisplayInfo leds1 = null; GetScreenInfoByUDID(param.Content, out commPort1, out leds1); if (string.IsNullOrEmpty(commPort1) || leds1 == null) { TransFerDataHandlerCallback(TransferType.M3_BlackScreen, "false", userParam); return; } SetBlackScreen(TransferType.M3_BlackScreen, commPort1, leds1, 0, userParam); break; case TransferType.M3_NormalScreen: //TODO:正常显示 string commPort2 = string.Empty; ILEDDisplayInfo leds2 = null; GetScreenInfoByUDID(param.Content, out commPort1, out leds1); if (string.IsNullOrEmpty(commPort1) || leds1 == null) { TransFerDataHandlerCallback(TransferType.M3_NormalScreen, "false", userParam); return; } SetNormalScreen(TransferType.M3_NormalScreen, commPort2, leds2, 0, userParam); break; case TransferType.M3_ReadBrightness: _fLogService.Info("读取亮度值。。。"); break; } } catch (Exception ex) { try { lock (_lockCallBack) { _dicCallBack.Remove(userParam); } } catch (Exception exc) { _fLogService.Error("ExistCatch:去除字典中的ID时出现异常:" + exc.ToString()); } _fLogService.Error("ExistCatch:CommandBack Exception:" + ex.ToString()); } }