| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | using DPumpHydr.WinFrmUI.RLT.Controls; |
| | | using DPumpHydr.WinFrmUI.Volute.ViewModel; |
| | | using static System.Runtime.InteropServices.JavaScript.JSType; |
| | | using static System.Windows.Forms.VisualStyles.VisualStyleElement; |
| | | |
| | |
| | | BuildAllTips(); |
| | | BuildIcon(); |
| | | } |
| | | ViewModel.SectionBaseInfo _paras = null; |
| | | public void SetBindingData(ViewModel.SectionBaseInfo vm) |
| | | { |
| | | this._paras = vm; |
| | | if (vm == null) |
| | | { |
| | | return; |
| | | } |
| | | this.mTextBoxEditè室平åé度.Text = vm.V3.ToString(); |
| | | for (var argument = 1; argument <= 8; argument++) |
| | | { |
| | | var controlnamey1 = $"skyTextBoxæé¢y1{argument}"; |
| | | var controlnamey2 = $"skyTextBoxæé¢y2{argument}"; |
| | | var controlnameæé¢é¢ç§¯ = $"skyTextBoxæé¢é¢ç§¯{argument}"; |
| | | SkyTextBox controly1 = this.Controls.Find(controlnamey1, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controly2 = this.Controls.Find(controlnamey2, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controlæé¢é¢ç§¯ = this.Controls.Find(controlnameæé¢é¢ç§¯, true).FirstOrDefault() as SkyTextBox; |
| | | if (controly1 != null) |
| | | controly1.Text = vm.GaMa1[argument].ToString(); |
| | | if (controly2 != null) |
| | | controly2.Text = vm.GaMa2[argument].ToString(); |
| | | if (controlæé¢é¢ç§¯ != null) |
| | | controlæé¢é¢ç§¯.Text = vm.Area[argument].ToString(); |
| | | } |
| | | if (_paras.ShapeType == eSectionShapeType.对称) |
| | | { |
| | | RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked = true; |
| | | RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked = false; |
| | | RBtnç©å½¢.Checked = false; |
| | | } |
| | | if (_paras.ShapeType == eSectionShapeType.ä¸å¯¹ç§°) |
| | | { |
| | | RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked = false; |
| | | RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked = true; |
| | | RBtnç©å½¢.Checked = false; |
| | | } |
| | | if (_paras.ShapeType == eSectionShapeType.ç©å½¢) |
| | | { |
| | | RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked = false; |
| | | RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked = false; |
| | | RBtnç©å½¢.Checked = true; |
| | | } |
| | | |
| | | } |
| | | public ViewModel.SectionBaseInfo GetBindingData(out string error) |
| | | { |
| | | if (!Verify(out error)) |
| | | { |
| | | return null; |
| | | } |
| | | error = null; |
| | | if (_paras == null) |
| | | { |
| | | _paras = new ViewModel.SectionBaseInfo(); |
| | | } |
| | | _paras.V3 = Convert.ToDouble(this.mTextBoxEditè室平åé度.Text); |
| | | for (var argument = 1; argument <= 8; argument++) |
| | | { |
| | | var controlnamey1 = $"skyTextBoxæé¢y1{argument}"; |
| | | var controlnamey2 = $"skyTextBoxæé¢y2{argument}"; |
| | | var controlnameæé¢é¢ç§¯ = $"skyTextBoxæé¢é¢ç§¯{argument}"; |
| | | SkyTextBox controlY1 = this.Controls.Find(controlnamey1, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controlY2 = this.Controls.Find(controlnamey2, true).FirstOrDefault() as SkyTextBox; |
| | | SkyTextBox controlæé¢é¢ç§¯ = this.Controls.Find(controlnameæé¢é¢ç§¯, true).FirstOrDefault() as SkyTextBox; |
| | | if (controlY1 != null) |
| | | _paras.GaMa1[argument] = Convert.ToDouble(controlY1.Text); |
| | | if (controlY2 != null) |
| | | _paras.GaMa2[argument] = Convert.ToDouble(controlY2.Text); |
| | | if (controlæé¢é¢ç§¯ != null) |
| | | _paras.Area[argument] = Convert.ToDouble(controlæé¢é¢ç§¯.Text); |
| | | } |
| | | _paras.GaMa1[8] = Convert.ToDouble(this.skyTextBoxæé¢y18.Text); |
| | | _paras.GaMa2[8] = Convert.ToDouble(this.skyTextBoxæé¢y28.Text); |
| | | if (RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked) |
| | | { |
| | | _paras.ShapeType = eSectionShapeType.对称; |
| | | } |
| | | if (RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked) |
| | | { |
| | | _paras.ShapeType = eSectionShapeType.ä¸å¯¹ç§°; |
| | | } |
| | | if (RBtnç©å½¢.Checked) |
| | | { |
| | | _paras.ShapeType = eSectionShapeType.ç©å½¢; |
| | | } |
| | | return _paras; |
| | | } |
| | | public bool Verify(out string error) |
| | | { |
| | | error = ""; |
| | | bool isOk = true; |
| | | if (string.IsNullOrEmpty(mTextBoxEditè室平åé度.Text) || mTextBoxEditè室平åé度.Text == "请è¾å
¥") |
| | | if (string.IsNullOrEmpty(mTextBoxEditè室平åé度.Text) || double.Parse(mTextBoxEditè室平åé度.Text) == 0) |
| | | { |
| | | error = "请è¾å
¥å¿
填项ï¼"; |
| | | isOk = false; |
| | | mTextBoxEditè室平åé度.TrailingIcon = GlobalResource.GetTipTrailingIcon(); |
| | | skyLabelè室平åé度.Visible = true; |
| | | } |
| | | if (string.IsNullOrEmpty(skyTextBoxæé¢VIIIy1.Text)) |
| | | if (string.IsNullOrEmpty(skyTextBoxæé¢y18.Text) || double.Parse(skyTextBoxæé¢y18.Text) == 0) |
| | | { |
| | | error = "请è¾å
¥å¿
填项ï¼"; |
| | | isOk = false; |
| | | skyLabelæç¤ºy2.Visible = false; |
| | | skyLabely2.Visible = true; |
| | | } |
| | | if (string.IsNullOrEmpty(skyTextBoxæé¢VIIIy2.Text)) |
| | | if (string.IsNullOrEmpty(skyTextBoxæé¢y28.Text) || double.Parse(skyTextBoxæé¢y28.Text) == 0) |
| | | { |
| | | error = "请è¾å
¥å¿
填项ï¼"; |
| | | isOk = false; |
| | |
| | | return isOk; |
| | | } |
| | | |
| | | public bool IsParameterChange() |
| | | { |
| | | if(double.Parse(mTextBoxEditè室平åé度.Text) != this._paras.V3) |
| | | { |
| | | return true; |
| | | } |
| | | if(RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked && this._paras.ShapeType == eSectionShapeType.对称) |
| | | { |
| | | return true; |
| | | } if(RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked && this._paras.ShapeType == eSectionShapeType.ä¸å¯¹ç§°) |
| | | { |
| | | return true; |
| | | } if(RBtnç©å½¢.Checked && this._paras.ShapeType == eSectionShapeType.ç©å½¢) |
| | | { |
| | | return true; |
| | | } |
| | | if (double.Parse(skyTextBoxæé¢y18.Text) != this._paras.GaMa1[8]) |
| | | { |
| | | return true; |
| | | }if (double.Parse(skyTextBoxæé¢y28.Text) != this._paras.GaMa2[8]) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | private void BuildIcon() |
| | | { |
| | | //å¯¹è¯æ¡åç¼å¾ç |
| | | mTextBoxEditè室平åé度.LeadingIcon = GlobalResource.GetLeadingIcon(); |
| | | |
| | | //æé¢å½¢ç¶å¾ç |
| | | metroTile对称梯形.BackgroundImage = GlobalResource.BuildImage("duichentixing.png",97,88); |
| | | metroTile对称梯形.BackgroundImage = GlobalResource.BuildImage("duichentixing.png", 97, 88); |
| | | metroTileä¸å¯¹ç§°æ¢¯å½¢.BackgroundImage = GlobalResource.BuildImage("buduichentixing.png", 97, 88); |
| | | metroTileç©å½¢.BackgroundImage = GlobalResource.BuildImage("juxing.png", 97, 88); |
| | | } |
| | |
| | | metroToolTipç¬¬ä¸æ¥æç¤º.SetToolTip(this.metroTileä¸å¯¹ç§°æ¢¯å½¢, "ä¸å¯¹ç§°æ¢¯å½¢"); |
| | | metroToolTipç¬¬ä¸æ¥æç¤º.SetToolTip(this.metroTileç©å½¢, "ç©å½¢"); |
| | | metroToolTipç¬¬ä¸æ¥æç¤º.SetToolTip(this.mTextBoxEditè室平åé度, "æ¶²ä½å¨è室å
æµå¨\næ¶çå¹³åé度"); |
| | | metroToolTipç¬¬ä¸æ¥æç¤º.SetToolTip(this.skyTextBoxæé¢VIIIy1, "y1 è§£é"); |
| | | metroToolTipç¬¬ä¸æ¥æç¤º.SetToolTip(this.skyTextBoxæé¢VIIIy2, "y2 è§£é"); |
| | | metroToolTipç¬¬ä¸æ¥æç¤º.SetToolTip(this.skyTextBoxæé¢y18, "y1 è§£é"); |
| | | metroToolTipç¬¬ä¸æ¥æç¤º.SetToolTip(this.skyTextBoxæé¢y28, "y2 è§£é"); |
| | | } |
| | | private void metroTileæé¢å½¢ç¶1_Click(object sender, EventArgs e) |
| | | { |
| | |
| | | { |
| | | skyLabelè室平åé度.Visible = false; |
| | | mTextBoxEditè室平åé度.TrailingIcon = null; |
| | | if (mTextBoxEditè室平åé度.Text == "请è¾å
¥") |
| | | { |
| | | mTextBoxEditè室平åé度.Text = ""; |
| | | } |
| | | } |
| | | |
| | | private void mTextBoxEditè室平åé度_Leave(object sender, EventArgs e) |
| | | { |
| | | if (string.IsNullOrEmpty(mTextBoxEditè室平åé度.Text)) |
| | | if (string.IsNullOrEmpty(mTextBoxEditè室平åé度.Text) || double.Parse(mTextBoxEditè室平åé度.Text) == 0) |
| | | { |
| | | mTextBoxEditè室平åé度.Text = "请è¾å
¥"; |
| | | mTextBoxEditè室平åé度.Text = _paras.V3.ToString(); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | foreach (var s in mTextBoxEditè室平åé度.Text) |
| | | { |
| | | if (!double.TryParse(mTextBoxEditè室平åé度.Text, out double result) && !string.IsNullOrEmpty(mTextBoxEditè室平åé度.Text) && mTextBoxEditè室平åé度.Text != "请è¾å
¥") |
| | | if (!double.TryParse(mTextBoxEditè室平åé度.Text, out double result) && !string.IsNullOrEmpty(mTextBoxEditè室平åé度.Text) ) |
| | | { |
| | | mTextBoxEditè室平åé度.UseAccent = true; |
| | | mTextBoxEditè室平åé度.ShowAssistiveText = true; |
| | |
| | | |
| | | private void skyTextBoxæé¢VIIIy1_TextChanged(object sender, EventArgs e) |
| | | { |
| | | foreach (var s in skyTextBoxæé¢VIIIy1.Text) |
| | | foreach (var s in skyTextBoxæé¢y18.Text) |
| | | { |
| | | if (!double.TryParse(skyTextBoxæé¢VIIIy1.Text, out double result) && !string.IsNullOrEmpty(skyTextBoxæé¢VIIIy1.Text)) |
| | | if (!double.TryParse(skyTextBoxæé¢y18.Text, out double result) && !string.IsNullOrEmpty(skyTextBoxæé¢y18.Text)) |
| | | { |
| | | skyTextBoxæé¢VIIIy1.Text = ""; |
| | | skyTextBoxæé¢y18.Text = _paras.GaMa1[8].ToString(); |
| | | skyLabelæç¤ºy1.Visible = true; |
| | | break; |
| | | } |
| | |
| | | |
| | | private void skyTextBoxæé¢VIIIy2_TextChanged(object sender, EventArgs e) |
| | | { |
| | | foreach (var s in skyTextBoxæé¢VIIIy2.Text) |
| | | foreach (var s in skyTextBoxæé¢y28.Text) |
| | | { |
| | | if (!double.TryParse(skyTextBoxæé¢VIIIy2.Text, out double result) && !string.IsNullOrEmpty(skyTextBoxæé¢VIIIy2.Text)) |
| | | if (!double.TryParse(skyTextBoxæé¢y28.Text, out double result) && !string.IsNullOrEmpty(skyTextBoxæé¢y28.Text)) |
| | | { |
| | | skyTextBoxæé¢VIIIy2.Text = ""; |
| | | skyTextBoxæé¢y28.Text = _paras.GaMa2[8].ToString(); |
| | | skyLabelæç¤ºy2.Visible = true; |
| | | break; |
| | | } |
| | |
| | | |
| | | private void mBtnè®¡ç®æé¢é¢ç§¯_Click(object sender, EventArgs e) |
| | | { |
| | | if (string.IsNullOrEmpty(mTextBoxEditè室平åé度.Text) || mTextBoxEditè室平åé度.Text != "请è¾å
¥è室平åé度") |
| | | if (string.IsNullOrEmpty(mTextBoxEditè室平åé度.Text) || mTextBoxEditè室平åé度.Text == "请è¾å
¥è室平åé度") |
| | | { |
| | | skyLabelè室平åé度.Visible = true; |
| | | MessageBox.Show("请å
è¾å
¥è室平åé度ï¼"); |
| | |
| | | |
| | | private void mlBtnæ´æ¹æé¢è§åº¦_Click(object sender, EventArgs e) |
| | | { |
| | | if (!RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked && !RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked && !RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked) |
| | | if (!RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked && !RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked && !RBtnç©å½¢.Checked) |
| | | { |
| | | MessageBox.Show("请å
éæ©æé¢ç±»åï¼"); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(skyTextBoxæé¢VIIIy1.Text) || string.IsNullOrEmpty(skyTextBoxæé¢VIIIy2.Text)) |
| | | if (string.IsNullOrEmpty(skyTextBoxæé¢y18.Text) || string.IsNullOrEmpty(skyTextBoxæé¢y28.Text)) |
| | | { |
| | | skyLabelæç¤ºy2.Visible = false; |
| | | skyLabelæç¤ºy1.Visible = false; |
| | |
| | | } |
| | | } |
| | | |
| | | private void RBtnæé¢å¯¹ç§°æ¢¯å½¢_CheckedChanged(object sender) |
| | | { |
| | | if (RBtnæé¢å¯¹ç§°æ¢¯å½¢.Checked) |
| | | { |
| | | skyTextBoxæé¢y18.Enabled = true; |
| | | skyTextBoxæé¢y28.Enabled = false; |
| | | } |
| | | } |
| | | |
| | | |
| | | private void RBtnä¸å¯¹ç§°æ¢¯å½¢_CheckedChanged(object sender) |
| | | { |
| | | if (RBtnä¸å¯¹ç§°æ¢¯å½¢.Checked) |
| | | { |
| | | skyTextBoxæé¢y18.Enabled = true; |
| | | skyTextBoxæé¢y28.Enabled = true; |
| | | } |
| | | } |
| | | } |
| | | } |