public static bool IsEquals(this PeripheralsLocation self, UseablePeripheral peripheral) { return((((peripheral.FirstSenderSN.Split('-')[0] == self.FirstSenderSN.Split('-')[0]) && (peripheral.FuncCardIndex == self.FuncCardIndex)) && ((peripheral.PortIndex == self.PortIndex) && (peripheral.SenderIndex == self.SenderIndex))) && ((peripheral.SensorIndex == self.SensorIndex) && (peripheral.SensorType == self.SensorType))); }
private void confirmButton_Click(object sender, EventArgs e) { ConfigState = LightSensorConfigState.OK_State; if (_useablePeripheral == null || _useablePeripheral.Count == 0) { ConfigState = LightSensorConfigState.NoSensor_State; } if (_brightnessMappingTable == null || _brightnessMappingTable.Count == 0) { ConfigState = LightSensorConfigState.NoMapping_State; } for (int i = 0; i < opticalProbeDataGridView.Rows.Count; i++) { var cell = opticalProbeDataGridView.Rows[i].Cells[3] as DataGridViewTextBoxCell; string cellValue = cell.Value as string; if (!string.IsNullOrEmpty(cellValue)) { ConfigState = LightSensorConfigState.InvalidSensor_State; break; } } brightnessDataGridView_Validated(sender, e); BrightExtendData = new AutoBrightExtendData(); BrightExtendData.AutoBrightMappingList = new List <DisplayAutoBrightMapping>(); BrightExtendData.UseLightSensorList = new List <PeripheralsLocation>(); if (this.enableCheckBox.Checked) { BrightExtendData.OpticalFailureInfo = new OpticalProbeFailureInfo() { IsEnable = true, BrightnessValue = (int)this.brightnessNumericUpDown.Value }; } else { BrightExtendData.OpticalFailureInfo = new OpticalProbeFailureInfo() { IsEnable = false, BrightnessValue = (int)this.brightnessNumericUpDown.Value }; } foreach (var mappingItem in _brightnessMappingTable) { var displayBrightMapping = new DisplayAutoBrightMapping(); displayBrightMapping.EnvironmentBright = mappingItem.EnvironmentBrightness; displayBrightMapping.DisplayBright = mappingItem.LedBrightness; BrightExtendData.AutoBrightMappingList.Add(displayBrightMapping); } foreach (var peripheralItem in _useablePeripheral) { var peripheral = new UseablePeripheral(); peripheral = peripheralItem; BrightExtendData.UseLightSensorList.Add(peripheral); } BrightExtendData.AutoBrightMappingList.Sort(CompareBrightnessByValue); this.DialogResult = System.Windows.Forms.DialogResult.OK; }
private static string GetPositionViewData(UseablePeripheral opticalProbeItem) { string positionViewData = string.Empty; if (opticalProbeItem.SensorType == PeripheralsType.LightSensorOnSender) { positionViewData = opticalProbeItem.FirstSenderSN + "-" + (opticalProbeItem.SenderIndex + 1); } else if (opticalProbeItem.SensorType == PeripheralsType.LightSensorOnFuncCardInPort) { positionViewData = opticalProbeItem.FirstSenderSN + "-" + (opticalProbeItem.SenderIndex + 1) + "-" + (opticalProbeItem.PortIndex + 1) + "-" + (opticalProbeItem.FuncCardIndex + 1) + "-" + (opticalProbeItem.SensorIndex + 1); } return(positionViewData); }
private string GetLocationString(UseablePeripheral periInfo, AllCOMHWBaseInfo info) { string comName = CustomTransform.GetSerialPortNameBySn(periInfo.FirstSenderSN, info); string strSender = ""; CommonStaticMethod.GetLanguageString("发送卡", "Lang_Global_SendingBoard", out strSender); string strPort = ""; CommonStaticMethod.GetLanguageString("网口", "Lang_Global_NetPort", out strPort); string strFuncCard = ""; CommonStaticMethod.GetLanguageString("多功能卡", "Lang_Gloabal_FunctionCard", out strFuncCard); string strSensor = ""; CommonStaticMethod.GetLanguageString("接口", "Lang_Gloabal_SensorIndexOnFuncCard", out strSensor); string strSensorInSender = ""; CommonStaticMethod.GetLanguageString("发送卡上的光探头:", "Lang_Bright_SensorOnSender", out strSensorInSender); string strSensorInFunc = ""; CommonStaticMethod.GetLanguageString("多功能卡上的光探头:", "Lang_Bright_SensorOnFuncCard", out strSensorInFunc); string msg = ""; if (periInfo.SensorType == PeripheralsType.LightSensorOnFuncCardInPort) { msg = strSensorInFunc + comName + "-" + strSender + (periInfo.SenderIndex + 1) + "-" + strPort + (periInfo.PortIndex + 1) + "-" + strFuncCard + (periInfo.FuncCardIndex + 1) + "-" + strSensor + (periInfo.SensorIndex + 1); } else { msg = strSensorInSender + comName + "-" + strSender + (periInfo.SenderIndex + 1); } return msg; }
public static bool IsEquals(this PeripheralsLocation self, UseablePeripheral peripheral) { return ((((peripheral.FirstSenderSN.Split('-')[0] == self.FirstSenderSN.Split('-')[0]) && (peripheral.FuncCardIndex == self.FuncCardIndex)) && ((peripheral.PortIndex == self.PortIndex) && (peripheral.SenderIndex == self.SenderIndex))) && ((peripheral.SensorIndex == self.SensorIndex) && (peripheral.SensorType == self.SensorType))); }