| | |
| | | using System.Drawing; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | |
| | | InitializeComponent(); |
| | | BuildAllTips(); |
| | | BuildIcon(); |
| | | |
| | | //skyTextBoxæé¢y18.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(8); |
| | | //}; |
| | | //skyTextBoxæé¢r18.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(8); |
| | | //}; |
| | | //skyTextBoxæé¢H18.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(8); |
| | | //}; |
| | | crownLabelVIII.DoubleClick += (ss, ee) => |
| | | { |
| | | HightLightSectCurve(8); |
| | | }; |
| | | |
| | | //skyTextBoxæé¢y17.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(7); |
| | | //}; |
| | | //skyTextBoxæé¢r17.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(7); |
| | | //}; |
| | | //skyTextBoxæé¢H17.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(7); |
| | | //}; |
| | | crownLabelVII.DoubleClick += (ss, ee) => |
| | | { |
| | | HightLightSectCurve(7); |
| | | }; |
| | | |
| | | |
| | | //skyTextBoxæé¢y16.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(6); |
| | | //}; |
| | | //skyTextBoxæé¢r16.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(6); |
| | | //}; |
| | | //skyTextBoxæé¢H16.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(6); |
| | | //}; |
| | | crownLabelVI.DoubleClick += (ss, ee) => |
| | | { |
| | | HightLightSectCurve(6); |
| | | }; |
| | | |
| | | //skyTextBoxæé¢y15.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(5); |
| | | //}; |
| | | //skyTextBoxæé¢r15.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(5); |
| | | //}; |
| | | //skyTextBoxæé¢H15.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(5); |
| | | //}; |
| | | crownLabelV.DoubleClick += (ss, ee) => |
| | | { |
| | | HightLightSectCurve(5); |
| | | }; |
| | | |
| | | //skyTextBoxæé¢y14.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(4); |
| | | //}; |
| | | //skyTextBoxæé¢r14.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(4); |
| | | //}; |
| | | //skyTextBoxæé¢H14.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(4); |
| | | //}; |
| | | crownLabelIV.DoubleClick += (ss, ee) => |
| | | { |
| | | HightLightSectCurve(4); |
| | | }; |
| | | |
| | | |
| | | //skyTextBoxæé¢y13.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(3); |
| | | //}; |
| | | //skyTextBoxæé¢r13.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(3); |
| | | //}; |
| | | //skyTextBoxæé¢H13.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(3); |
| | | //}; |
| | | crownLabelIII.DoubleClick += (ss, ee) => |
| | | { |
| | | HightLightSectCurve(3); |
| | | }; |
| | | |
| | | |
| | | //skyTextBoxæé¢y12.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(2); |
| | | //}; |
| | | //skyTextBoxæé¢r12.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(2); |
| | | //}; |
| | | //skyTextBoxæé¢H12.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(2); |
| | | //}; |
| | | crownLabelII.DoubleClick += (ss, ee) => |
| | | { |
| | | HightLightSectCurve(2); |
| | | }; |
| | | |
| | | //skyTextBoxæé¢y11.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(1); |
| | | //}; |
| | | //skyTextBoxæé¢r11.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(1); |
| | | //}; |
| | | //skyTextBoxæé¢H11.Click += (ss, ee) => |
| | | //{ |
| | | // HightLightSectCurve(1); |
| | | //}; |
| | | crownLabelI.DoubleClick += (ss, ee) => |
| | | { |
| | | HightLightSectCurve(1); |
| | | }; |
| | | } |
| | | ViewModel.SectionBundleInfo _paras = null; |
| | | |
| | | ViewModel.SectionBundleInfo _sectionBundleInfo = null; |
| | | ViewModel.HdrBaseInfo _hdrBaseInfo = null; |
| | | ViewModel.GeomBaseInfo _geomBaseInfo = null; |
| | | public void InitialParas(HdrBaseInfo BaseInfo, GeomBaseInfo geom_info) |
| | | |
| | | |
| | | public void ShowPage( |
| | | ViewModel.HdrBaseInfo base_info, |
| | | ViewModel.GeomBaseInfo geom_info, |
| | | DPumpHydr.ViewModel.eWizardStepDiretion step_direction,bool isRefreshModel = true) |
| | | { |
| | | this._hdrBaseInfo = BaseInfo; |
| | | this._geomBaseInfo = geom_info; |
| | | } |
| | | public void SetBindingData(ViewModel.SectionBundleInfo vm) |
| | | { |
| | | this._paras = vm; |
| | | if (vm == null) |
| | | if (step_direction == DPumpHydr.ViewModel.eWizardStepDiretion.åé) |
| | | { |
| | | return; |
| | | } |
| | | this.mTextBoxEditè室平åé度.Text = vm.V3.ToString(); |
| | | this._hdrBaseInfo = base_info; |
| | | this._geomBaseInfo = geom_info; |
| | | |
| | | if (_paras.ShapeType == eSectionShapeType.对称) |
| | | if (_sectionBundleInfo == null) |
| | | { |
| | | _sectionBundleInfo = new ViewModel.SectionBundleInfo(); |
| | | |
| | | _sectionBundleInfo.BaseWidth = _geomBaseInfo.B3; |
| | | _sectionBundleInfo.BaseCircleRadius = _geomBaseInfo.D3 / 2; |
| | | |
| | | _sectionBundleInfo.ResetAllParas(_hdrBaseInfo, _geomBaseInfo); |
| | | } |
| | | else |
| | | { |
| | | if (Math.Abs(_sectionBundleInfo.BaseWidth - _geomBaseInfo.B3) < 1 && |
| | | Math.Abs(_sectionBundleInfo.BaseCircleRadius - _geomBaseInfo.D3 / 2) < 1) |
| | | { |
| | | _sectionBundleInfo.BaseWidth = _geomBaseInfo.B3; |
| | | _sectionBundleInfo.BaseCircleRadius = _geomBaseInfo.D3 / 2; |
| | | RefreshShape(_sectionBundleInfo); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | RefreshAllSectPara(_sectionBundleInfo); |
| | | |
| | | if (isRefreshModel == false) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | RefreshShape(_sectionBundleInfo); |
| | | } |
| | | private void pictureBoxRefreshK3_Click(object sender, EventArgs e) |
| | | { |
| | | _sectionBundleInfo.InitialK3(this._hdrBaseInfo, this._geomBaseInfo); |
| | | |
| | | RefreshAllSectPara(_sectionBundleInfo); |
| | | } |
| | | // |
| | | public void RefreshAllSectPara(ViewModel.SectionBundleInfo paras) |
| | | { |
| | | this._sectionBundleInfo = paras; |
| | | |
| | | this.textBoxK3.Text = _sectionBundleInfo.K3.ToString(); |
| | | this.textBoxV3.Text = _sectionBundleInfo.V3.ToString(); |
| | | |
| | | if (_sectionBundleInfo.ShapeType == eSectionShapeType.对称) |
| | | { |
| | | RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked = true; |
| | | RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked = false; |
| | | RBtnç©å½¢.Checked = false; |
| | | } |
| | | if (_paras.ShapeType == eSectionShapeType.ä¸å¯¹ç§°) |
| | | if (_sectionBundleInfo.ShapeType == eSectionShapeType.ä¸å¯¹ç§°) |
| | | { |
| | | RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked = false; |
| | | RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked = true; |
| | | RBtnç©å½¢.Checked = false; |
| | | } |
| | | if (_paras.ShapeType == eSectionShapeType.ç©å½¢) |
| | | if (_sectionBundleInfo.ShapeType == eSectionShapeType.ç©å½¢) |
| | | { |
| | | RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked = false; |
| | | RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked = false; |
| | | RBtnç©å½¢.Checked = true; |
| | | } |
| | | |
| | | RefrehPara(); |
| | | RefrehSectBundlePara(); |
| | | } |
| | | private void RefrehPara() |
| | | //æ¹é¢ç§¯ |
| | | public void RefreshSingleSectArea(int sectIndex, double area) |
| | | { |
| | | for (var argument = 1; argument <= 8; argument++) |
| | | { |
| | | var controlnameGama1 = $"skyTextBoxæé¢y1{argument}"; |
| | | var controlnameRia1 = $"skyTextBoxæé¢r1{argument}"; |
| | | var controlnameæé¢é¢ç§¯ = $"skyTextBoxæé¢é¢ç§¯{argument}"; |
| | | var controlnameHeight = $"skyTextBoxæé¢H1{argument}"; |
| | | if (this._sectionBundleInfo == null) |
| | | return; |
| | | this._sectionBundleInfo.Area[sectIndex] = area; |
| | | this._sectionBundleInfo.CalcHeightByArea(_geomBaseInfo, sectIndex); |
| | | |
| | | SkyTextBox controly1 = this.Controls.Find(controlnameGama1, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controly2 = this.Controls.Find(controlnameRia1, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controlæé¢é¢ç§¯ = this.Controls.Find(controlnameæé¢é¢ç§¯, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controH1 = this.Controls.Find(controlnameHeight, true).FirstOrDefault() as SkyTextBox; |
| | | RefrehSectBundlePara(); |
| | | |
| | | if (controly1 != null) |
| | | controly1.Text = _paras.GaMa_Left[argument].ToString(); |
| | | if (controly2 != null) |
| | | controly2.Text = _paras.R_Left[argument].ToString(); |
| | | if (controlæé¢é¢ç§¯ != null) |
| | | controlæé¢é¢ç§¯.Text = _paras.Area[argument].ToString(); |
| | | if (controH1 != null) |
| | | controH1.Text = _paras.H[argument].ToString(); |
| | | } |
| | | if (OnRefreshShape == null) |
| | | return; |
| | | OnRefreshShape.Invoke(_sectionBundleInfo); |
| | | } |
| | | |
| | | |
| | | |
| | | public ViewModel.SectionBundleInfo GetBindingData(out string error) |
| | | { |
| | | if (!Verify(out error)) |
| | |
| | | return null; |
| | | } |
| | | error = null; |
| | | if (_paras == null) |
| | | if (_sectionBundleInfo == null) |
| | | { |
| | | _paras = new ViewModel.SectionBundleInfo(); |
| | | _sectionBundleInfo = new ViewModel.SectionBundleInfo(); |
| | | } |
| | | |
| | | if (RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked) |
| | | { |
| | | _paras.ShapeType = eSectionShapeType.对称; |
| | | _sectionBundleInfo.ShapeType = eSectionShapeType.对称; |
| | | } |
| | | if (RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked) |
| | | { |
| | | _paras.ShapeType = eSectionShapeType.ä¸å¯¹ç§°; |
| | | _sectionBundleInfo.ShapeType = eSectionShapeType.ä¸å¯¹ç§°; |
| | | } |
| | | if (RBtnç©å½¢.Checked) |
| | | { |
| | | _paras.ShapeType = eSectionShapeType.ç©å½¢; |
| | | _sectionBundleInfo.ShapeType = eSectionShapeType.ç©å½¢; |
| | | } |
| | | |
| | | _paras.V3 = Convert.ToDouble(this.mTextBoxEditè室平åé度.Text); |
| | | _sectionBundleInfo.V3 = Convert.ToDouble(this.textBoxV3.Text); |
| | | for (var argument = 1; argument <= 8; argument++) |
| | | { |
| | | var controlname_y1 = $"skyTextBoxæé¢y1{argument}"; |
| | |
| | | SkyTextBox controlæé¢é¢ç§¯ = this.Controls.Find(controlnameæé¢é¢ç§¯, true).FirstOrDefault() as SkyTextBox; |
| | | if (controlY1 != null) |
| | | { |
| | | _paras.GaMa_Left[argument] = Convert.ToDouble(controlY1.Text); |
| | | _paras.GaMa_Right[argument] = _paras.GaMa_Left[argument]; |
| | | _sectionBundleInfo.GaMa_Left[argument] = Convert.ToDouble(controlY1.Text); |
| | | _sectionBundleInfo.GaMa_Right[argument] = _sectionBundleInfo.GaMa_Left[argument]; |
| | | } |
| | | |
| | | |
| | | if (controlR1 != null) |
| | | { |
| | | _paras.R_Left[argument] = Convert.ToDouble(controlR1.Text); |
| | | _paras.R_Right[argument] = _paras.R_Left[argument]; |
| | | _sectionBundleInfo.R_Left[argument] = Convert.ToDouble(controlR1.Text); |
| | | _sectionBundleInfo.R_Right[argument] = _sectionBundleInfo.R_Left[argument]; |
| | | } |
| | | |
| | | if (controlæé¢é¢ç§¯ != null) |
| | | _paras.Area[argument] = Convert.ToDouble(controlæé¢é¢ç§¯.Text); |
| | | } |
| | | |
| | | |
| | | return _paras; |
| | | if (controlæé¢é¢ç§¯ != null) |
| | | _sectionBundleInfo.Area[argument] = Convert.ToDouble(controlæé¢é¢ç§¯.Text); |
| | | } |
| | | |
| | | |
| | | return _sectionBundleInfo; |
| | | } |
| | | public bool Verify(out string error) |
| | | { |
| | | error = ""; |
| | | bool isOk = true; |
| | | if (string.IsNullOrEmpty(mTextBoxEditè室平åé度.Text) || double.Parse(mTextBoxEditè室平åé度.Text) == 0) |
| | | double v3 = 0; |
| | | if (string.IsNullOrEmpty(textBoxV3.Text) || !double.TryParse(textBoxV3.Text, out v3) || v3 <= 0.1) |
| | | { |
| | | error = "请è¾å
¥å¿
填项ï¼"; |
| | | isOk = false; |
| | | mTextBoxEditè室平åé度.TrailingIcon = GlobalResource.GetTipTrailingIcon(); |
| | | skyLabelè室平åé度.Visible = true; |
| | | } |
| | | if (string.IsNullOrEmpty(skyTextBoxæé¢y18.Text) || double.Parse(skyTextBoxæé¢y18.Text) == 0) |
| | | if (string.IsNullOrEmpty(skyTextBoxæé¢y18.Text) || double.Parse(skyTextBoxæé¢y18.Text) <= 0) |
| | | { |
| | | error = "请è¾å
¥å¿
填项ï¼"; |
| | | isOk = false; |
| | | |
| | | |
| | | } |
| | | if (string.IsNullOrEmpty(skyTextBoxæé¢r18.Text) || double.Parse(skyTextBoxæé¢r18.Text) == 0) |
| | | if (string.IsNullOrEmpty(skyTextBoxæé¢r18.Text) || double.Parse(skyTextBoxæé¢r18.Text) <= 0) |
| | | { |
| | | error = "请è¾å
¥å¿
填项ï¼"; |
| | | isOk = false; |
| | |
| | | |
| | | public bool IsParameterChange() |
| | | { |
| | | if (double.Parse(mTextBoxEditè室平åé度.Text) != this._paras.V3) |
| | | if (double.Parse(textBoxV3.Text) != this._sectionBundleInfo.V3) |
| | | { |
| | | return true; |
| | | } |
| | | if (RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked && this._paras.ShapeType == eSectionShapeType.对称) |
| | | if (RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked && this._sectionBundleInfo.ShapeType == eSectionShapeType.对称) |
| | | { |
| | | return true; |
| | | } |
| | | if (RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked && this._paras.ShapeType == eSectionShapeType.ä¸å¯¹ç§°) |
| | | if (RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked && this._sectionBundleInfo.ShapeType == eSectionShapeType.ä¸å¯¹ç§°) |
| | | { |
| | | return true; |
| | | } |
| | | if (RBtnç©å½¢.Checked && this._paras.ShapeType == eSectionShapeType.ç©å½¢) |
| | | if (RBtnç©å½¢.Checked && this._sectionBundleInfo.ShapeType == eSectionShapeType.ç©å½¢) |
| | | { |
| | | return true; |
| | | } |
| | | if (double.Parse(skyTextBoxæé¢y18.Text) != this._paras.GaMa_Left[8]) |
| | | if (double.Parse(skyTextBoxæé¢y18.Text) != this._sectionBundleInfo.GaMa_Left[8]) |
| | | { |
| | | return true; |
| | | } |
| | | if (double.Parse(skyTextBoxæé¢r18.Text) != this._paras.GaMa_Right[8]) |
| | | if (double.Parse(skyTextBoxæé¢r18.Text) != this._sectionBundleInfo.GaMa_Right[8]) |
| | | { |
| | | return true; |
| | | } |
| | |
| | | |
| | | private void BuildIcon() |
| | | { |
| | | //å¯¹è¯æ¡åç¼å¾ç |
| | | mTextBoxEditè室平åé度.LeadingIcon = GlobalResource.GetLeadingIcon(); |
| | | |
| | | //æé¢å½¢ç¶å¾ç |
| | | metroTile对称梯形.BackgroundImage = GlobalResource.BuildImage("duichentixing.png", 97, 88); |
| | | metroTileä¸å¯¹ç§°æ¢¯å½¢.BackgroundImage = GlobalResource.BuildImage("buduichentixing.png", 97, 88); |
| | |
| | | |
| | | private void BuildAllTips() |
| | | { |
| | | metroToolTipç¬¬ä¸æ¥æç¤º.SetToolTip(this.metroTile对称梯形, "对称梯形"); |
| | | metroToolTipç¬¬ä¸æ¥æç¤º.SetToolTip(this.metroTileä¸å¯¹ç§°æ¢¯å½¢, "ä¸å¯¹ç§°æ¢¯å½¢"); |
| | | metroToolTipç¬¬ä¸æ¥æç¤º.SetToolTip(this.metroTileç©å½¢, "ç©å½¢"); |
| | | metroToolTipç¬¬ä¸æ¥æç¤º.SetToolTip(this.mTextBoxEditè室平åé度, "æ¶²ä½å¨è室å
æµå¨\næ¶çå¹³åé度"); |
| | | metroToolTipç¬¬ä¸æ¥æç¤º.SetToolTip(this.skyTextBoxæé¢y18, "y1 è§£é"); |
| | | metroToolTipç¬¬ä¸æ¥æç¤º.SetToolTip(this.skyTextBoxæé¢r18, "y2 è§£é"); |
| | | //metroToolTipæç¤º.SetToolTip(this.metroTile对称梯形, "对称梯形"); |
| | | //metroToolTipæç¤º.SetToolTip(this.metroTileä¸å¯¹ç§°æ¢¯å½¢, "ä¸å¯¹ç§°æ¢¯å½¢"); |
| | | //metroToolTipæç¤º.SetToolTip(this.metroTileç©å½¢, "ç©å½¢"); |
| | | //metroToolTipæç¤º.SetToolTip(this.skyTextBoxæé¢y18, "y1 è§£é"); |
| | | //metroToolTipæç¤º.SetToolTip(this.skyTextBoxæé¢r18, "y2 è§£é"); |
| | | } |
| | | private void metroTileæé¢å½¢ç¶1_Click(object sender, EventArgs e) |
| | | { |
| | | RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked = true; |
| | | RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked = false; |
| | | RBtnç©å½¢.Checked = false; |
| | | |
| | | } |
| | | |
| | | private void metroTileæé¢å½¢ç¶2_Click(object sender, EventArgs e) |
| | |
| | | RBtnç©å½¢.Checked = true; |
| | | } |
| | | |
| | | private void mTextBoxEditè室平åé度_Enter(object sender, EventArgs e) |
| | | { |
| | | skyLabelè室平åé度.Visible = false; |
| | | mTextBoxEditè室平åé度.TrailingIcon = null; |
| | | } |
| | | |
| | | private void mTextBoxEditè室平åé度_Leave(object sender, EventArgs e) |
| | | { |
| | | if (string.IsNullOrEmpty(mTextBoxEditè室平åé度.Text) || double.Parse(mTextBoxEditè室平åé度.Text) == 0) |
| | | { |
| | | mTextBoxEditè室平åé度.Text = _paras.V3.ToString(); |
| | | } |
| | | } |
| | | |
| | | private void mTextBoxEditè室平åé度_TextChanged(object sender, EventArgs e) |
| | | { |
| | | foreach (var s in mTextBoxEditè室平åé度.Text) |
| | | { |
| | | if (!double.TryParse(mTextBoxEditè室平åé度.Text, out double result) && !string.IsNullOrEmpty(mTextBoxEditè室平åé度.Text)) |
| | | { |
| | | mTextBoxEditè室平åé度.UseAccent = true; |
| | | mTextBoxEditè室平åé度.ShowAssistiveText = true; |
| | | mTextBoxEditè室平åé度.Text = ""; |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | mTextBoxEditè室平åé度.ShowAssistiveText = false; |
| | | mTextBoxEditè室平åé度.UseAccent = false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | private void skyTextBoxæé¢VIIIy1_TextChanged(object sender, EventArgs e) |
| | | { |
| | | foreach (var s in skyTextBoxæé¢y18.Text) |
| | | if (sender is SkyTextBox skytextBox) |
| | | { |
| | | if (!double.TryParse(skyTextBoxæé¢y18.Text, out double result) && !string.IsNullOrEmpty(skyTextBoxæé¢y18.Text)) |
| | | string lastChar = skytextBox.Name[skytextBox.Name.Length - 1].ToString(); |
| | | int index = Convert.ToInt32(lastChar); |
| | | if (!double.TryParse(skytextBox.Text, out double result) && !string.IsNullOrEmpty(skytextBox.Text)) |
| | | { |
| | | skyTextBoxæé¢y18.Text = _paras.GaMa_Left[8].ToString(); |
| | | |
| | | break; |
| | | skytextBox.Text = _sectionBundleInfo.GaMa_Left[index].ToString(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void skyTextBoxæé¢VIIIy2_TextChanged(object sender, EventArgs e) |
| | | { |
| | | foreach (var s in skyTextBoxæé¢r18.Text) |
| | | if (sender is SkyTextBox skytextBox) |
| | | { |
| | | if (!double.TryParse(skyTextBoxæé¢r18.Text, out double result) && !string.IsNullOrEmpty(skyTextBoxæé¢r18.Text)) |
| | | string lastChar = skytextBox.Name[skytextBox.Name.Length - 1].ToString(); |
| | | int index = Convert.ToInt32(lastChar); |
| | | if (!double.TryParse(skytextBox.Text, out double result) && !string.IsNullOrEmpty(skytextBox.Text)) |
| | | { |
| | | skyTextBoxæé¢r18.Text = _paras.GaMa_Right[8].ToString(); |
| | | //skyLabelæç¤ºy2.Visible = true; |
| | | break; |
| | | skytextBox.Text = _sectionBundleInfo.GaMa_Right[index].ToString(); |
| | | } |
| | | if (string.IsNullOrEmpty(skytextBox.Text)) |
| | | { |
| | | MessageBox.Show("rä¸åçï¼è¯·éæ°è¾å
¥"); |
| | | } |
| | | |
| | | if (Convert.ToDouble(skytextBox.Text) != _sectionBundleInfo.R_Left[index]) |
| | | { |
| | | Judgment_R(index); |
| | | } |
| | | else |
| | | { |
| | | skytextBox.BackColor = Color.White; |
| | | } |
| | | } |
| | | } |
| | | private void skyTextBoxæé¢VIIIy1_Enter(object sender, EventArgs e) |
| | | { |
| | | |
| | | |
| | | } |
| | | |
| | | private void skyTextBoxæé¢VIIIy2_Enter(object sender, EventArgs e) |
| | | public bool Judgment_R(int index) |
| | | { |
| | | //skyLabely2.Visible = false; |
| | | bool isreasonable = true; |
| | | SkyTextBox controlr1 = this.Controls.Find($"skyTextBoxæé¢r1{index}", true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controlGaMa1 = this.Controls.Find($"skyTextBoxæé¢y1{index}", true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controlh1 = this.Controls.Find($"skyTextBoxæé¢H1{index}", true).FirstOrDefault() as SkyTextBox; |
| | | //ç®åè¿ä¸ªåªæ£æµå¯¹ç§°ç b3-2(r1-(tan(Gama1)*(h-r1))) //è¥ä¸å¯¹ç§° b3-ï¼r1-(tan(Gama1)*(h-r1))ï¼-ï¼r2-(tan(Gama2)*(h-r2))ï¼ |
| | | var a = _sectionBundleInfo.BaseWidth - 2 * (Convert.ToDouble(controlr1.Text) - (Math.Tan(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180) * (Convert.ToDouble(controlh1.Text) - Convert.ToDouble(controlr1.Text))));//_sectionBundleInfo.R_out/200 |
| | | if ((!RBtnç©å½¢.Checked && _sectionBundleInfo.BaseWidth-2*(Convert.ToDouble(controlr1.Text) - ( Math.Tan(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180)* (Convert.ToDouble(controlh1.Text)- Convert.ToDouble(controlr1.Text)))) < 10) || Convert.ToDouble(controlr1.Text) == 0) |
| | | { |
| | | controlr1.BackColor = Color.OrangeRed; |
| | | MessageBox.Show("rä¸åçï¼è¯·éæ°è¾å
¥"); |
| | | } |
| | | else |
| | | { |
| | | controlr1.BackColor = Color.White; |
| | | } |
| | | |
| | | return isreasonable; |
| | | } |
| | | |
| | | |
| | | |
| | | private void mBtnè®¡ç®æé¢é¢ç§¯_Click(object sender, EventArgs e) |
| | | { |
| | | if (string.IsNullOrEmpty(mTextBoxEditè室平åé度.Text) || mTextBoxEditè室平åé度.Text == "请è¾å
¥è室平åé度") |
| | | double v3 = 0; |
| | | if (string.IsNullOrEmpty(textBoxV3.Text) || !double.TryParse(textBoxV3.Text, out v3) || v3 <= 0.1) |
| | | { |
| | | skyLabelè室平åé度.Visible = true; |
| | | MessageBox.Show("请å
è¾å
¥è室平åé度ï¼"); |
| | | return; |
| | | } |
| | | if (_paras == null) |
| | | if (_sectionBundleInfo == null) |
| | | { |
| | | _paras = new ViewModel.SectionBundleInfo(); |
| | | _sectionBundleInfo = new ViewModel.SectionBundleInfo(); |
| | | } |
| | | double v3 = Convert.ToDouble(mTextBoxEditè室平åé度.Text); |
| | | _paras.V3 = v3; |
| | | _paras.CalcParaV3(this._hdrBaseInfo,this._geomBaseInfo, v3); |
| | | RefrehPara(); |
| | | _sectionBundleInfo.V3 = v3; |
| | | _sectionBundleInfo.RecalculateArea(this._hdrBaseInfo, this._geomBaseInfo); |
| | | |
| | | RefrehSectBundlePara(); |
| | | |
| | | |
| | | if (OnRefreshShape != null) |
| | | { |
| | | ViewModel.SectionBundleInfo paras = GetBindingData(out string error); |
| | | if (paras == null) |
| | | return; |
| | | //textBoxå²èè§åº¦ |
| | | OnRefreshShape.Invoke(paras); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void mlBtnæ´æ¹æé¢è§åº¦_Click(object sender, EventArgs e) |
| | | { |
| | | if (!RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked && !RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked && !RBtnç©å½¢.Checked) |
| | | { |
| | | MessageBox.Show("请å
éæ©æé¢ç±»åï¼"); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(skyTextBoxæé¢y18.Text) || string.IsNullOrEmpty(skyTextBoxæé¢r18.Text)) |
| | | { |
| | | //skyLabelæç¤ºy2.Visible = false; |
| | | //skyLabelæç¤ºy1.Visible = false; |
| | | //skyLabely1.Visible = true; |
| | | //skyLabely2.Visible = true; |
| | | //MessageBox.Show("请å
è¾å
¥y1ãy2ï¼"); |
| | | return; |
| | | } |
| | | //if (!RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked && !RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked && !RBtnç©å½¢.Checked) |
| | | //{ |
| | | // MessageBox.Show("请å
éæ©æé¢ç±»åï¼"); |
| | | // return; |
| | | //} |
| | | //if (string.IsNullOrEmpty(skyTextBoxæé¢y18.Text) || string.IsNullOrEmpty(skyTextBoxæé¢r18.Text)) |
| | | //{ |
| | | // //skyLabelæç¤ºy2.Visible = false; |
| | | // //skyLabelæç¤ºy1.Visible = false; |
| | | // //skyLabely1.Visible = true; |
| | | // //skyLabely2.Visible = true; |
| | | // //MessageBox.Show("请å
è¾å
¥y1ãy2ï¼"); |
| | | // return; |
| | | //} |
| | | } |
| | | |
| | | private void RBtnæé¢å¯¹ç§°æ¢¯å½¢_CheckedChanged(object sender) |
| | |
| | | if (RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked) |
| | | { |
| | | skyTextBoxæé¢y18.Enabled = true; |
| | | skyTextBoxæé¢r18.Enabled = false; |
| | | //skyTextBoxæé¢r18.Enabled = false; |
| | | } |
| | | } |
| | | |
| | |
| | | if (RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked) |
| | | { |
| | | skyTextBoxæé¢y18.Enabled = true; |
| | | skyTextBoxæé¢r18.Enabled = true; |
| | | //skyTextBoxæé¢r18.Enabled = true; |
| | | } |
| | | } |
| | | public Action<ViewModel.SectionBundleInfo> OnRefreshShape = null; |
| | | private void materialButton1_Click(object sender, EventArgs e) |
| | | |
| | | |
| | | private void textBoxK3_TextChanged(object sender, EventArgs e) |
| | | { |
| | | double K3 = 0; |
| | | if (string.IsNullOrEmpty(textBoxK3.Text)) |
| | | return; |
| | | if (!double.TryParse(textBoxK3.Text, out K3)) |
| | | return; |
| | | if (K3 < 0.1) |
| | | return; |
| | | |
| | | var g = 9.81; |
| | | this.textBoxV3.Text = Math.Round(K3 * Math.Sqrt(2 * g * _hdrBaseInfo.Q), 2).ToString(); |
| | | } |
| | | |
| | | public Func<ViewModel.SectionBundleInfo, List<int>> OnRefreshShape = null; |
| | | private void mBtnæ´æ°æ¨¡å_Click(object sender, EventArgs e) |
| | | { |
| | | ViewModel.SectionBundleInfo paras = GetBindingData(out string error); |
| | | if (paras == null) |
| | | return; |
| | | |
| | | RefreshShape(paras); |
| | | |
| | | } |
| | | |
| | | private void RefreshShape(ViewModel.SectionBundleInfo paras) |
| | | { |
| | | if (OnRefreshShape == null) |
| | | return; |
| | | //paras.InitialAllParameters(this._hdrBaseInfo,this._geomBaseInfo); |
| | | OnRefreshShape.Invoke(paras); |
| | | var error_sects = OnRefreshShape.Invoke(paras); |
| | | |
| | | for (var sect_index = 1; sect_index <= 8; sect_index++) |
| | | { |
| | | var controlnameGama1 = $"skyTextBoxæé¢y1{sect_index}"; |
| | | var controlnameRia1 = $"skyTextBoxæé¢r1{sect_index}"; |
| | | var controlnameæé¢é¢ç§¯ = $"skyTextBoxæé¢é¢ç§¯{sect_index}"; |
| | | var controlnameHeight = $"skyTextBoxæé¢H1{sect_index}"; |
| | | |
| | | SkyTextBox controly1 = this.Controls.Find(controlnameGama1, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controly2 = this.Controls.Find(controlnameRia1, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controlæé¢é¢ç§¯ = this.Controls.Find(controlnameæé¢é¢ç§¯, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controH1 = this.Controls.Find(controlnameHeight, true).FirstOrDefault() as SkyTextBox; |
| | | |
| | | |
| | | if (error_sects != null && error_sects.Contains(sect_index)) |
| | | { |
| | | controly1.BackColor = Color.OrangeRed; |
| | | controly2.BackColor = Color.OrangeRed; |
| | | controlæé¢é¢ç§¯.BackColor = Color.OrangeRed; |
| | | controH1.BackColor = Color.OrangeRed; |
| | | } |
| | | else |
| | | { |
| | | controly1.BackColor = Color.White; |
| | | controly2.BackColor = Color.White; |
| | | controlæé¢é¢ç§¯.BackColor = Color.White; |
| | | controH1.BackColor = Color.White; |
| | | } |
| | | } |
| | | } |
| | | public Action<int> OnHightLightSectCurve = null; |
| | | private void HightLightSectCurve(int sectIndex) |
| | | { |
| | | if (OnHightLightSectCurve != null) |
| | | OnHightLightSectCurve.Invoke(sectIndex); |
| | | } |
| | | |
| | | private void RefrehSectBundlePara() |
| | | { |
| | | for (var sect_index = 1; sect_index <= 8; sect_index++) |
| | | { |
| | | var controlnameGama1 = $"skyTextBoxæé¢y1{sect_index}"; |
| | | var controlnameRia1 = $"skyTextBoxæé¢r1{sect_index}"; |
| | | var controlnameæé¢é¢ç§¯ = $"skyTextBoxæé¢é¢ç§¯{sect_index}"; |
| | | var controlnameHeight = $"skyTextBoxæé¢H1{sect_index}"; |
| | | |
| | | SkyTextBox controly1 = this.Controls.Find(controlnameGama1, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controly2 = this.Controls.Find(controlnameRia1, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controlæé¢é¢ç§¯ = this.Controls.Find(controlnameæé¢é¢ç§¯, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controH1 = this.Controls.Find(controlnameHeight, true).FirstOrDefault() as SkyTextBox; |
| | | |
| | | if (controly1 != null) |
| | | controly1.Text = _sectionBundleInfo.GaMa_Left[sect_index].ToString(); |
| | | if (controly2 != null) |
| | | controly2.Text = _sectionBundleInfo.R_Left[sect_index].ToString(); |
| | | if (controlæé¢é¢ç§¯ != null) |
| | | controlæé¢é¢ç§¯.Text = _sectionBundleInfo.Area[sect_index].ToString(); |
| | | if (controH1 != null) |
| | | controH1.Text = _sectionBundleInfo.H[sect_index].ToString(); |
| | | } |
| | | } |
| | | |
| | | private void skyTextBoxæé¢r17_TextChanged(object sender, EventArgs e) |
| | | { |
| | | if (!double.TryParse(skyTextBoxæé¢r17.Text, out double result) && !string.IsNullOrEmpty(skyTextBoxæé¢r17.Text)) |
| | | { |
| | | skyTextBoxæé¢r17.Text = _sectionBundleInfo.GaMa_Right[7].ToString(); |
| | | } |
| | | if (string.IsNullOrEmpty(skyTextBoxæé¢r17.Text)) |
| | | { |
| | | MessageBox.Show("rä¸åçï¼è¯·éæ°è¾å
¥"); |
| | | } |
| | | if (Convert.ToDouble(skyTextBoxæé¢r17.Text) != _sectionBundleInfo.R_Left[7]) |
| | | { |
| | | Judgment_R(7); |
| | | } |
| | | } |
| | | |
| | | private void skyTextBoxæé¢y11_Enter(object sender, EventArgs e) |
| | | { |
| | | if (sender is SkyTextBox skytextBox) |
| | | { |
| | | string lastChar = skytextBox.Name[skytextBox.Name.Length - 1].ToString(); |
| | | int index = Convert.ToInt32(lastChar); |
| | | HightLightSectCurve(index); |
| | | } |
| | | } |
| | | |
| | | private void btnNextStep_Click(object sender, EventArgs e) |
| | | { |
| | | NextStep(); |
| | | } |
| | | } |
| | | } |