| | |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | using DPumpHydr.WinFrmUI.RLT.Controls; |
| | | using DPumpHydr.WinFrmUI.RLT.Controls; |
| | | using DPumpHydr.WinFrmUI.Volute.ViewModel; |
| | | |
| | | namespace DPumpHydr.WinFrmUI.Volute |
| | |
| | | ViewModel.SectionBundleInfo _sectionBundleInfo = null; |
| | | ViewModel.HdrBaseInfo _hdrBaseInfo = null; |
| | | ViewModel.GeomBaseInfo _geomBaseInfo = null; |
| | | |
| | | public void SetBindingData(ViewModel.SectionBundleInfo sectionBundle_info) |
| | | { |
| | | _sectionBundleInfo = sectionBundle_info; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¾ç¤ºçé¢ |
| | | /// </summary> |
| | | /// <param name="base_info">åºæ¬åæ°</param> |
| | | /// <param name="geom_info">åºååæ°</param> |
| | | /// <param name="step_direction">åè¿/åé</param> |
| | | /// <param name="isRefreshModel">æ¯å¦éè¦è¦çæé¢åæ°</param> |
| | | public void ShowPage( |
| | | ViewModel.HdrBaseInfo base_info, |
| | | ViewModel.GeomBaseInfo geom_info, |
| | | DPumpHydr.ViewModel.eWizardStepDiretion step_direction,bool isxml) |
| | | DPumpHydr.ViewModel.eWizardStepDiretion step_direction, bool isRefreshModel = false) |
| | | { |
| | | if (step_direction == DPumpHydr.ViewModel.eWizardStepDiretion.åé) |
| | | { |
| | | return; |
| | | } |
| | | this._hdrBaseInfo = base_info; |
| | | this._geomBaseInfo = geom_info; |
| | | if (isxml) |
| | | if (_hdrBaseInfo == null && _geomBaseInfo == null) |
| | | { |
| | | _hdrBaseInfo = base_info; |
| | | _geomBaseInfo = geom_info; |
| | | } |
| | | if (!isRefreshModel) |
| | | { |
| | | return; |
| | | } |
| | | if (_sectionBundleInfo == null) |
| | | { |
| | | this._hdrBaseInfo = base_info; |
| | | this._geomBaseInfo = geom_info; |
| | | _sectionBundleInfo = new ViewModel.SectionBundleInfo(); |
| | | |
| | | _sectionBundleInfo.BaseWidth = _geomBaseInfo.B3; |
| | |
| | | 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); |
| | | if (_hdrBaseInfo.n != base_info.n || _hdrBaseInfo.Q != base_info.Q || _hdrBaseInfo.H != base_info.H || _hdrBaseInfo.IsSXB != base_info.IsSXB) |
| | | { |
| | | this._hdrBaseInfo = base_info; |
| | | this._geomBaseInfo = geom_info; |
| | | _sectionBundleInfo.InitialK3(this._hdrBaseInfo, this._geomBaseInfo); |
| | | RefreshAllSectPara(_sectionBundleInfo); |
| | | _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); |
| | | } |
| | | //RefreshShape(_sectionBundleInfo); |
| | | } |
| | | else |
| | | { |
| | | this._hdrBaseInfo = base_info; |
| | | this._geomBaseInfo = geom_info; |
| | | RefreshShape(_sectionBundleInfo); |
| | | } |
| | | |
| | | return; |
| | | } |
| | | } |
| | | |
| | | |
| | | RefreshAllSectPara(_sectionBundleInfo); |
| | | |
| | |
| | | this.textBoxK3.Text = _sectionBundleInfo.K3.ToString(); |
| | | this.textBoxV3.Text = _sectionBundleInfo.V3.ToString(); |
| | | |
| | | |
| | | RefrehSectBundlePara(); |
| | | if (_sectionBundleInfo.ShapeType == eSectionShapeType.对称) |
| | | { |
| | | RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked = true; |
| | |
| | | RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked = false; |
| | | RBtnç©å½¢.Checked = true; |
| | | } |
| | | |
| | | RefrehSectBundlePara(); |
| | | } |
| | | //æ¹é¢ç§¯ |
| | | public void RefreshSingleSectArea(int sectIndex, double area) |
| | |
| | | |
| | | _sectionBundleInfo.V3 = Convert.ToDouble(this.textBoxV3.Text); |
| | | for (var argument = 1; argument <= 8; argument++) |
| | | { |
| | | {//skyTextBoxæé¢H18 |
| | | var controlname_y1 = $"skyTextBoxæé¢y1{argument}"; |
| | | var controlname_r1 = $"skyTextBoxæé¢r1{argument}"; |
| | | var controlnameæé¢é¢ç§¯ = $"skyTextBoxæé¢é¢ç§¯{argument}"; |
| | | var controlnameh = $"skyTextBoxæé¢H1{argument}"; |
| | | SkyTextBox controlY1 = this.Controls.Find(controlname_y1, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controlR1 = this.Controls.Find(controlname_r1, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controlæé¢é¢ç§¯ = this.Controls.Find(controlnameæé¢é¢ç§¯, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controlH = this.Controls.Find(controlnameh, true).FirstOrDefault() as SkyTextBox; |
| | | if (controlY1 != null) |
| | | { |
| | | _sectionBundleInfo.GaMa_Left[argument] = Convert.ToDouble(controlY1.Text); |
| | |
| | | |
| | | if (controlæé¢é¢ç§¯ != null) |
| | | _sectionBundleInfo.Area[argument] = Convert.ToDouble(controlæé¢é¢ç§¯.Text); |
| | | |
| | | if (controlH != null) |
| | | _sectionBundleInfo.H[argument] = Convert.ToDouble(controlH.Text); |
| | | } |
| | | |
| | | |
| | |
| | | error = "请è¾å
¥å¿
填项ï¼"; |
| | | isOk = false; |
| | | } |
| | | if (string.IsNullOrEmpty(skyTextBoxæé¢y18.Text) || double.Parse(skyTextBoxæé¢y18.Text) <= 0) |
| | | if (string.IsNullOrEmpty(skyTextBoxæé¢y18.Text) || (!RBtnç©å½¢.Checked && double.Parse(skyTextBoxæé¢y18.Text) == 0) || 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) || (!RBtnç©å½¢.Checked && double.Parse(skyTextBoxæé¢r18.Text) == 0) || double.Parse(skyTextBoxæé¢y18.Text) < 0) |
| | | { |
| | | error = "请è¾å
¥å¿
填项ï¼"; |
| | | isOk = false; |
| | |
| | | int index = Convert.ToInt32(lastChar); |
| | | if (!double.TryParse(skytextBox.Text, out double result) && !string.IsNullOrEmpty(skytextBox.Text)) |
| | | { |
| | | result = _sectionBundleInfo.GaMa_Left[index]; |
| | | skytextBox.Text = _sectionBundleInfo.GaMa_Left[index].ToString(); |
| | | }else if(result>45) |
| | | { |
| | | MessageBox.Show("请è¾å
¥å°äº45度çè§åº¦"); |
| | | skytextBox.Text = _sectionBundleInfo.GaMa_Left[index].ToString(); |
| | | } |
| | | else |
| | | { |
| | | //var initialR = _sectionBundleInfo.CalInitialR(_hdrBaseInfo, _geomBaseInfo); |
| | | var height = _sectionBundleInfo.CalcHeight(_geomBaseInfo, index, result, _sectionBundleInfo.R_Left[index]); |
| | | var R = _sectionBundleInfo.CheckChamferR(height, index, result, _sectionBundleInfo.R_Left[index]); |
| | | SkyTextBox controlh1 = this.Controls.Find($"skyTextBoxæé¢H1{index}", true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controlr1 = this.Controls.Find($"skyTextBoxæé¢r1{index}", true).FirstOrDefault() as SkyTextBox; |
| | | controlh1.Text = height.ToString(); |
| | | controlr1.Text = R.ToString(); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | skytextBox.Text = _sectionBundleInfo.GaMa_Right[index].ToString(); |
| | | } |
| | | if (string.IsNullOrEmpty(skytextBox.Text)) |
| | | if (string.IsNullOrEmpty(skytextBox.Text) || Convert.ToDouble(skytextBox.Text) == 0) |
| | | { |
| | | MessageBox.Show("rä¸åçï¼è¯·éæ°è¾å
¥"); |
| | | } |
| | | |
| | | double v = 0; |
| | | if (!double.TryParse(skytextBox.Text, out v)) |
| | | { |
| | | MessageBox.Show("请è¾å
¥æ°åæ ¼å¼ï¼"); |
| | | return; |
| | | } |
| | | if (Convert.ToDouble(skytextBox.Text) != _sectionBundleInfo.R_Left[index]) |
| | | { |
| | | Judgment_R(index); |
| | |
| | | |
| | | } |
| | | |
| | | public bool Judgment_R(int index) |
| | | private bool Judgment_R(int index) |
| | | { |
| | | 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) |
| | | if (string.IsNullOrEmpty(controlr1.Text)) |
| | | return true; |
| | | if (string.IsNullOrEmpty(controlGaMa1.Text)) |
| | | return true; |
| | | if (string.IsNullOrEmpty(controlh1.Text)) |
| | | return true; |
| | | |
| | | if (RBtnç©å½¢.Checked) |
| | | { |
| | | controlr1.BackColor = Color.OrangeRed; |
| | | MessageBox.Show("rä¸åçï¼è¯·éæ°è¾å
¥"); |
| | | if (Convert.ToDouble(controlh1.Text) - Convert.ToDouble(controlr1.Text) < 1 || _sectionBundleInfo.BaseWidth - (Convert.ToDouble(controlr1.Text) * 2) < 1) |
| | | { |
| | | controlr1.BackColor = Color.OrangeRed; |
| | | MessageBox.Show("rä¸åçï¼è¯·éæ°è¾å
¥"); |
| | | } |
| | | else |
| | | { |
| | | controlr1.BackColor = Color.White; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | controlr1.BackColor = Color.White; |
| | | //ç®åè¿ä¸ªåªæ£æµå¯¹ç§°ç //è¥ä¸å¯¹ç§°æ´æ¢åå¾è§åº¦çåæ°éæ°è®¡ç®å¦ä¸è¾¹x |
| | | var x = Math.Tan(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180) * Convert.ToDouble(controlh1.Text) |
| | | - (Math.Tan(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180) * Math.Tan(Convert.ToDouble(controlGaMa1.Text) / 2 * Math.PI / 180) * Convert.ToDouble(controlr1.Text)) |
| | | - (Math.Tan(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180) * Convert.ToDouble(controlr1.Text)) - Convert.ToDouble(controlr1.Text); |
| | | var c = _sectionBundleInfo.R_out / 1000; |
| | | var TopWidth = _sectionBundleInfo.BaseWidth + (2 * x); |
| | | var Slash = (Convert.ToDouble(controlh1.Text) - Convert.ToDouble(controlr1.Text) - (Math.Sin(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180) * Convert.ToDouble(controlr1.Text))) / Math.Cos(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180); |
| | | if ((!RBtnç©å½¢.Checked && (TopWidth < c || Slash < c - 0.1))) // |
| | | { |
| | | controlr1.BackColor = Color.OrangeRed; |
| | | MessageBox.Show("rä¸åçï¼è¯·éæ°è¾å
¥"); |
| | | } |
| | | else |
| | | { |
| | | controlr1.BackColor = Color.White; |
| | | } |
| | | } |
| | | |
| | | |
| | | return isreasonable; |
| | | } |
| | |
| | | { |
| | | if (RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked) |
| | | { |
| | | skyTextBoxæé¢y18.Enabled = true; |
| | | RefrehSectBundlePara(); |
| | | RefreshShape(_sectionBundleInfo); |
| | | //skyTextBoxæé¢y18.Enabled = true; |
| | | //skyTextBoxæé¢r18.Enabled = false; |
| | | } |
| | | } |
| | |
| | | { |
| | | if (RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked) |
| | | { |
| | | skyTextBoxæé¢y18.Enabled = true; |
| | | RefrehSectBundlePara(); |
| | | RefreshShape(_sectionBundleInfo); |
| | | //skyTextBoxæé¢y18.Enabled = true; |
| | | //skyTextBoxæé¢r18.Enabled = true; |
| | | } |
| | | } |
| | |
| | | return; |
| | | |
| | | var g = 9.81; |
| | | this.textBoxV3.Text = Math.Round(K3 * Math.Sqrt(2 * g * _hdrBaseInfo.Q), 2).ToString(); |
| | | this.textBoxV3.Text = Math.Round(K3 * Math.Sqrt(2 * g * _hdrBaseInfo.H), 2).ToString(); |
| | | } |
| | | |
| | | public Func<ViewModel.SectionBundleInfo, List<int>> OnRefreshShape = null; |
| | |
| | | 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(); |
| | | controly1.Enabled = true; |
| | | if (controlæé¢é¢ç§¯ != null) |
| | | controlæé¢é¢ç§¯.Text = _sectionBundleInfo.Area[sect_index].ToString(); |
| | | controlæé¢é¢ç§¯.Text = Math.Round(_sectionBundleInfo.Area[sect_index], 1).ToString(); |
| | | if (controH1 != null) |
| | | controH1.Text = _sectionBundleInfo.H[sect_index].ToString(); |
| | | controH1.Text = Math.Round(_sectionBundleInfo.H[sect_index], 1).ToString(); |
| | | if (controly2 != null) |
| | | controly2.Text = Math.Round(_sectionBundleInfo.R_Left[sect_index], 1).ToString(); |
| | | if (controly1 != null) |
| | | controly1.Text = Math.Round(_sectionBundleInfo.GaMa_Left[sect_index], 1).ToString(); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | NextStep(); |
| | | } |
| | | |
| | | private void RBtnç©å½¢_CheckedChanged(object sender) |
| | | { |
| | | if (RBtnç©å½¢.Checked) |
| | | { |
| | | if(_sectionBundleInfo.GaMa_Left.All(x => x == 0)) |
| | | { |
| | | for (var sect_index = 1; sect_index <= 8; sect_index++) |
| | | { |
| | | var controlnameGama1 = $"skyTextBoxæé¢y1{sect_index}"; |
| | | SkyTextBox controly1 = this.Controls.Find(controlnameGama1, true).FirstOrDefault() as SkyTextBox; |
| | | controly1.Enabled = false; |
| | | } |
| | | return; |
| | | } |
| | | //for (var sect_index = 1; sect_index <= 8; sect_index++) |
| | | //{ |
| | | // var controlnameGama1 = $"skyTextBoxæé¢y1{sect_index}"; |
| | | // SkyTextBox controly1 = this.Controls.Find(controlnameGama1, true).FirstOrDefault() as SkyTextBox; |
| | | // controly1.Text = "0"; |
| | | // controly1.Enabled = false; |
| | | //} |
| | | ViewModel.SectionBundleInfo Rec_sectionBundleInfo = _sectionBundleInfo.Copy(); |
| | | Rec_sectionBundleInfo.ShapeType = eSectionShapeType.ç©å½¢; |
| | | Rec_sectionBundleInfo.ResetAllParas(_hdrBaseInfo, _geomBaseInfo); |
| | | 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; |
| | | controly1.Enabled = false; |
| | | if (controly1 != null) |
| | | controly1.Text = Rec_sectionBundleInfo.GaMa_Left[sect_index].ToString(); |
| | | if (controly2 != null) |
| | | controly2.Text = Rec_sectionBundleInfo.R_Left[sect_index].ToString(); |
| | | if (controlæé¢é¢ç§¯ != null) |
| | | controlæé¢é¢ç§¯.Text = Rec_sectionBundleInfo.Area[sect_index].ToString(); |
| | | if (controH1 != null) |
| | | controH1.Text = Rec_sectionBundleInfo.H[sect_index].ToString(); |
| | | } |
| | | RefreshShape(Rec_sectionBundleInfo); |
| | | } |
| | | } |
| | | |
| | | private void skyTextBoxæé¢H11_TextChanged(object sender, EventArgs e) |
| | | { |
| | | if (sender is SkyTextBox skytextBox) |
| | | { |
| | | string lastChar = skytextBox.Name[skytextBox.Name.Length - 1].ToString(); |
| | | int index = Convert.ToInt32(lastChar); |
| | | if (!double.TryParse(skytextBox.Text, out double resultH) && !string.IsNullOrEmpty(skytextBox.Text)) |
| | | { |
| | | resultH = _sectionBundleInfo.H[index]; |
| | | skytextBox.Text = _sectionBundleInfo.H[index].ToString(); |
| | | } |
| | | else |
| | | { |
| | | SkyTextBox controlGaMa1 = this.Controls.Find($"skyTextBoxæé¢y1{index}", true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controlr1 = this.Controls.Find($"skyTextBoxæé¢r1{index}", true).FirstOrDefault() as SkyTextBox; |
| | | if (!double.TryParse(controlGaMa1.Text, out double resultGame) && !string.IsNullOrEmpty(controlGaMa1.Text)) |
| | | { |
| | | resultH = _sectionBundleInfo.GaMa_Left[index]; |
| | | } |
| | | var R = _sectionBundleInfo.HCalR(_geomBaseInfo, index, resultGame, resultH); |
| | | R = _sectionBundleInfo.CheckChamferR(resultH, index, resultH, R); |
| | | skytextBox.Text = resultH.ToString(); |
| | | controlr1.Text = R.ToString(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |