private void btnSubmit_Click(object sender, EventArgs e) { if (!(StringValidator.HasContent(this.tbWidth, this.lbWidth.Text) && StringValidator.HasContent(this.tbNetWidth, this.lbNetWidth.Text) && StringValidator.HasContent(this.tbNetHeight, this.lbNetHeight.Text) && StringValidator.IsUnsignedNumber(this.tbWidth) && StringValidator.IsUnsignedNumber(this.tbNetWidth) && StringValidator.IsUnsignedNumber(this.tbNetHeight)) ) { return; } Constants.ShowNetFlag = this.ckbShow.Checked; Constants.NetLineWidth = int.Parse(this.tbWidth.Text); Constants.LineSeperationHeight = int.Parse(this.tbNetHeight.Text); Constants.LineSeperationWidth = int.Parse(this.tbNetWidth.Text); Constants.ColorNetLine = this.lbColor.BackColor; Ini.SetItemValue("general", "showNet", this.ckbShow.Checked.ToString()); Ini.SetItemValue("general", "netWidth", this.tbNetWidth.Text); Ini.SetItemValue("general", "netHeight", this.tbNetHeight.Text); Ini.SetItemValue("general", "netLineWidth", this.tbWidth.Text); Ini.SetItemValue("general", "netLineColor", this.lbColor.BackColor.ToArgb().ToString()); this.refreshImageShow(); this.Close(); }
private bool PreCheckUserDataIsEnough() { areaBoardSelected = this.tcCamera.SelectedIndex == 0; return(initialConditionFlag && (areaBoardSelected && StringValidator.HasContent(this.tbSensorSide, this.lbSensor.Text) && StringValidator.HasContent(this.tbSensorOther, this.lbSensor.Text) && StringValidator.HasContent(this.tbFovSide, this.lbFov.Text) && StringValidator.HasContent(this.tbFovOther, this.lbFov.Text) && StringValidator.IsUnsignedRealNumber(this.tbSensorSide) && StringValidator.IsUnsignedRealNumber(this.tbSensorOther) && StringValidator.IsUnsignedRealNumber(this.tbFovSide) && StringValidator.IsUnsignedRealNumber(this.tbFovOther) && StringValidator.IsEmptyOrUnsignedRealNumber(this.tbResolutionSide) && StringValidator.IsEmptyOrUnsignedRealNumber(this.tbResolutionOther) || !areaBoardSelected && StringValidator.HasContent(this.tbLineSensor, this.lbLineSensor.Text) && StringValidator.HasContent(this.tbLineFov, this.lbLineFov.Text) && StringValidator.IsUnsignedRealNumber(this.tbLineSensor) && StringValidator.IsUnsignedRealNumber(this.tbLineFov) && StringValidator.IsEmptyOrUnsignedRealNumber(this.tbLineResolution) ) && StringValidator.HasContent(this.cbCamInter, this.lbCamInter.Text) && StringValidator.HasContent(this.tbFlange, this.lbFlange.Text) && StringValidator.IsUnsignedRealNumber(this.tbFlange) && StringValidator.IsEmptyOrUnsignedRealNumber(this.tbTarget) && StringValidator.IsEmptyOrUnsignedRealNumber(this.tbDistance) && StringValidator.IsEmptyOrUnsignedRealNumber(this.tbDistanRange)); }
private void btnSubmit_Click(object sender, EventArgs e) { if (!(StringValidator.HasContent(this.tbMinArea, this.gbArea.Text) && StringValidator.HasContent(this.tbMaxArea, this.gbArea.Text) && StringValidator.HasContent(this.tbMinRatio, this.gbRatio.Text) && StringValidator.HasContent(this.tbMaxRatio, this.gbRatio.Text) && StringValidator.IsUnsignedNumber(this.tbMinArea) && StringValidator.IsUnsignedNumber(this.tbMaxArea) && StringValidator.IsUnsignedRealNumber(this.tbMinRatio) && StringValidator.IsUnsignedRealNumber(this.tbMaxRatio)) ) { return; } Constants.MinRecogRectArea = int.Parse(this.tbMinArea.Text); Constants.MaxRecogRectArea = int.Parse(this.tbMaxArea.Text); Constants.MinRecogRectWHRatio = float.Parse(this.tbMinRatio.Text); Constants.MaxRecogRectWHRatio = float.Parse(this.tbMaxRatio.Text); Constants.AutoRecogColorFlag = this.ckbSwitch.Checked; Constants.LabelColor = this.colorLabelSelected; Ini.SetItemValue("general", "minLabelArea", this.tbMinArea.Text); Ini.SetItemValue("general", "maxLabelArea", this.tbMaxArea.Text); Ini.SetItemValue("general", "minLabelWHRatio", this.tbMinRatio.Text); Ini.SetItemValue("general", "maxLabelWHRatio", this.tbMaxRatio.Text); Ini.SetItemValue("general", "autoColorRecog", this.ckbSwitch.Checked.ToString()); Ini.SetItemValue("general", "labelColor", this.colorLabelSelected.ToString()); this.refreshImageShow(); this.Close(); }
private void btnSubmit_Click(object sender, EventArgs e) { if (!(StringValidator.HasContent(this.tbWidth, this.lbWidth.Text) && StringValidator.HasContent(this.tbRadiusLine, this.lbRadiusLine.Text) && StringValidator.HasContent(this.tbRadius, this.lbRadius.Text) && StringValidator.IsUnsignedNumber(this.tbWidth) && StringValidator.IsUnsignedNumber(this.tbRadiusLine) && StringValidator.IsUnsignedNumber(this.tbRadius)) ) { return; } Constants.RecogCircleRadiusBK = int.Parse(this.tbRadius.Text); Constants.RecogCircleRadiusInner = int.Parse(this.tbRadiusLine.Text); Constants.RecogCircleWidthInner = int.Parse(this.tbWidth.Text); Constants.RecogCircleColorBK = this.lbColorPoint.BackColor; Constants.RecogCircleColorInner = this.lbColorLine.BackColor; Ini.SetItemValue("general", "recogPointRadius", this.tbRadius.Text); Ini.SetItemValue("general", "recogPointLineRadius", this.tbRadiusLine.Text); Ini.SetItemValue("general", "recogPointLineWidth", this.tbWidth.Text); Ini.SetItemValue("general", "recogPointColor", this.lbColorPoint.BackColor.ToArgb().ToString()); Ini.SetItemValue("general", "recogPointLineColor", this.lbColorLine.BackColor.ToArgb().ToString()); this.refreshImageShow(); this.Close(); }
private void btnAdd_Click(object sender, EventArgs e) { List <LineFoot> lineList = new List <LineFoot>(); if (!StringValidator.HasContent(this.tbName, this.lbName.Text) || !StringValidator.HasContent(this.tbNumber, this.lbNumber.Text) || !this.CheckLocation(lineList)) { return; } if (this.tbNumber.Text.Trim().Length != 8) { MessageBox.Show("ID号要求为8位"); return; } int imgWidth = int.Parse(tbWidth.Text), imgHeight = int.Parse(tbHeight.Text); if (sourcePath != string.Empty) { filePath = "img\\" + tbName.Text.Trim() + Path.GetExtension(sourcePath); if (File.Exists(filePath)) { filePath = "img\\" + tbName.Text.Trim() + DateTime.Now.ToString("-yyMMddhhmmss") + Path.GetExtension(sourcePath); } Image newImg = Draw.ResizeImage(Image.FromFile(sourcePath), imgWidth, imgHeight); newImg.Save(filePath); } ElementInfo info = new ElementInfo(); info.Number = tbNumber.Text.Trim(); info.Name = tbName.Text.Trim(); info.FootType = rbComponent.Checked ? enumComponentType.NormalComponent : enumComponentType.Chips; info.Size = new System.Drawing.Size(imgWidth, imgHeight); info.BackColor = Color.Gray; info.LineFoots = lineList; info.BackImage = filePath; if (this.isCreateNewComponent) { this.createComponent(this, info); } else { info.ID = this.sourceInfo.ID; this.sourceInfo.Number = info.Number; this.sourceInfo.Name = info.Name; this.sourceInfo.FootType = info.FootType; this.sourceInfo.Size = info.Size; this.sourceInfo.BackColor = info.BackColor; this.sourceInfo.LineFoots = null; this.sourceInfo.LineFoots = info.LineFoots; this.sourceInfo.BackImage = info.BackImage; this.updateComponent(this, info); } }
private void btnSubmit_Click(object sender, EventArgs e) { if (!StringValidator.HasContent(this.tbWidth, this.lbWidth.Text) || !StringValidator.IsUnsignedNumber(this.tbWidth)) { return; } this.setLineWidth(int.Parse(this.tbWidth.Text)); this.Close(); }
private bool CheckDataBeforeSave() { bool emptyFlag = StringValidator.HasContent(this.tbName, this.lbName.Text) && StringValidator.HasContent(this.tbNumber, this.lbNumber.Text) && StringValidator.HasContent(this.cbInterA, this.lbInterA.Text) && StringValidator.HasContent(this.cbInterB, this.lbInterB.Text) && StringValidator.HasContent(this.tbLength, this.lbLength.Text) && StringValidator.IsUnsignedRealNumber(this.tbLength); if (emptyFlag && this.typeName == enumProductType.Focus) { emptyFlag = StringValidator.HasContent(this.tbLenMin, this.lbLenRange.Text) && StringValidator.HasContent(this.tbLenMax, this.lbLenRange.Text) && StringValidator.IsUnsignedRealNumber(this.tbLenMin) && StringValidator.IsUnsignedRealNumber(this.tbLenMax); } return(emptyFlag); }
private bool PreCheckUserDataIsEnough() { return(StringValidator.HasContent(this.tbResolutionH, this.lbResolution.Text) && StringValidator.HasContent(this.tbResolutionV, this.lbResolution.Text) && StringValidator.HasContent(this.tbFovH, this.lbFov.Text) && StringValidator.HasContent(this.tbFovV, this.lbFov.Text) && StringValidator.HasContent(this.tbFlange, this.lbFlange.Text) && StringValidator.HasContent(this.tbMagnifi, this.lbMagni.Text) && StringValidator.HasContent(this.tbFormat, this.lbFormat.Text) && StringValidator.IsUnsignedRealNumber(this.tbResolutionH) && StringValidator.IsUnsignedRealNumber(this.tbResolutionV) && StringValidator.IsUnsignedRealNumber(this.tbFovH) && StringValidator.IsUnsignedRealNumber(this.tbFovV) && StringValidator.IsUnsignedRealNumber(this.tbFlange) && StringValidator.IsUnsignedRealNumber(this.tbFormat) && StringValidator.IsUnsignedRealNumber(this.tbMagnifi)); }
private bool CheckDataBeforeSave() { return(StringValidator.HasContent(this.tbName, this.lbName.Text) && StringValidator.HasContent(this.tbNumber, this.lbNumber.Text) && StringValidator.HasContent(this.cbInter, this.lbInter.Text) && StringValidator.HasContent(this.tbFocus, this.lbFocus.Text) && StringValidator.IsUnsignedRealNumber(this.tbFocus) && StringValidator.HasContent(this.tbFlange, this.lbFlange.Text) && StringValidator.IsUnsignedRealNumber(this.tbFlange) && StringValidator.HasContent(this.tbTarget, this.lbTarget.Text) && StringValidator.IsUnsignedRealNumber(this.tbTarget) && StringValidator.HasContent(this.tbRatioMin, this.lbRatioRange.Text) && StringValidator.IsUnsignedRealNumber(this.tbRatioMin) && StringValidator.HasContent(this.tbRatioMax, this.lbRatioRange.Text) && StringValidator.IsUnsignedRealNumber(this.tbRatioMax) && StringValidator.HasContent(this.tbLength, this.lbLength.Text) && StringValidator.IsUnsignedRealNumber(this.tbLength) && StringValidator.HasContent(this.tbHH, this.lbLength.Text) && StringValidator.IsUnsignedRealNumber(this.tbHH) && //非必须 StringValidator.IsEmptyOrUnsignedRealNumber(this.tbFreq) && StringValidator.IsEmptyOrUnsignedRealNumber(this.tbWeight) && StringValidator.IsEmptyOrUnsignedRealNumber(this.tbDistort) && StringValidator.IsEmptyOrUnsignedInteger(this.tbResoLength) && StringValidator.IsEmptyOrUnsignedInteger(this.tbResoWidth)); }
private void btnSubmit_Click(object sender, EventArgs e) { if (!(StringValidator.HasContent(this.tbWidth, this.lbWidth.Text) && StringValidator.IsUnsignedNumber(this.tbWidth) )) { return; } Constants.LineWidthSelected = int.Parse(this.tbWidth.Text); Constants.LineColorSelected = this.lbColorLine.BackColor; Ini.SetItemValue("general", "selectedLineWidth", this.tbWidth.Text); Ini.SetItemValue("general", "selectedLineColor", this.lbColorLine.BackColor.ToArgb().ToString()); this.refreshImageShow(); this.Close(); }