From df88a15b84a7eee09c870dab8c0f5facd6c18c6e Mon Sep 17 00:00:00 2001 From: yangyin <1850366751@qq.com> Date: 星期三, 25 十二月 2024 09:34:28 +0800 Subject: [PATCH] 修改出水参数即选择界面 --- WinFrmUI/DPumpHydr.WinFrmUI.Volute/出水设计/参数控件/sideLineExitControl.cs | 301 ++++++++++++++++++++++++++++++++----------------- 1 files changed, 195 insertions(+), 106 deletions(-) diff --git "a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\345\207\272\346\260\264\350\256\276\350\256\241/\345\217\202\346\225\260\346\216\247\344\273\266/sideLineExitControl.cs" "b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\345\207\272\346\260\264\350\256\276\350\256\241/\345\217\202\346\225\260\346\216\247\344\273\266/sideLineExitControl.cs" index 7b93ce2..5b71eb4 100644 --- "a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\345\207\272\346\260\264\350\256\276\350\256\241/\345\217\202\346\225\260\346\216\247\344\273\266/sideLineExitControl.cs" +++ "b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\345\207\272\346\260\264\350\256\276\350\256\241/\345\217\202\346\225\260\346\216\247\344\273\266/sideLineExitControl.cs" @@ -1,4 +1,5 @@ 锘縰sing DPumpHydr.WinFrmUI.RLT.Controls; +using DPumpHydr.WinFrmUI.Volute.ViewModel; using System; using System.Collections.Generic; using System.ComponentModel; @@ -18,41 +19,106 @@ InitializeComponent(); BuildAllTips(); BuildIcon(); + Initialization(); + } + ViewModel.OtuflowParas _otuflowParas = null; + public void SetBindingData(ViewModel.OtuflowParas otuflowParas) + { + if (otuflowParas == null) + { + return; + } + _otuflowParas = otuflowParas; + //mlTextBoxEditR1.Text = otuflowParas.Offset.ToString(); + //mlTextBoxEditR2.Text = otuflowParas.Offset.ToString(); + mlTextBoxEdith1.Text = otuflowParas.H1.ToString(); + mlTextBoxEdith2.Text = otuflowParas.H2.ToString(); + mlTextBoxEditL.Text = otuflowParas.High.ToString(); + mlTextBoxEditr.Text = otuflowParas.Septalradius.ToString(); + mlTextBoxEditD4.Text = otuflowParas.Dia.ToString(); + mlTextBoxEditA.Text = otuflowParas.Offset.ToString(); + metroTrackBar宸︿笂鍒囩嚎缂╂斁閲�.Value = Convert.ToInt32(otuflowParas.TopValue_left * 100); + metroTrackBar宸︿笅鍒囩嚎缂╂斁閲�.Value = Convert.ToInt32(otuflowParas.BtmValue_left * 100); + metroTrackBar鍙充笂鍒囩嚎缂╂斁閲�.Value = Convert.ToInt32(otuflowParas.TopValue_reight * 100); + metroTrackBar鍙充笅鍒囩嚎缂╂斁閲�.Value = Convert.ToInt32(otuflowParas.BtmValue_reight * 100); + } + public ViewModel.OtuflowParas GetBindingData(out string error) + { + error = ""; + if (!Verify(out error)) + { + return null; + } + _otuflowParas.H1 = Convert.ToDouble(mlTextBoxEdith1.Text); + _otuflowParas.H2 = Convert.ToDouble(mlTextBoxEdith2.Text); + _otuflowParas.High = Convert.ToDouble(mlTextBoxEditL.Text); + _otuflowParas.Septalradius = Convert.ToDouble(mlTextBoxEditr.Text); + _otuflowParas.Dia = Convert.ToDouble(mlTextBoxEditD4.Text); + _otuflowParas.Offset = Convert.ToDouble(mlTextBoxEditA.Text); + _otuflowParas.TopValue_left = Convert.ToDouble(metroTrackBar宸︿笂鍒囩嚎缂╂斁閲�.Value) / 100; + _otuflowParas.BtmValue_left = Convert.ToDouble(metroTrackBar宸︿笅鍒囩嚎缂╂斁閲�.Value) / 100; + _otuflowParas.TopValue_reight = Convert.ToDouble(metroTrackBar鍙充笂鍒囩嚎缂╂斁閲�.Value) / 100; + _otuflowParas.BtmValue_reight = Convert.ToDouble(metroTrackBar鍙充笅鍒囩嚎缂╂斁閲�.Value) / 100; + return _otuflowParas; + + } + public void SetA_state(bool isEnabled) + { + if (!isEnabled) + { + mlTextBoxEditA.Text = 0.ToString(); + mlTextBoxEditA.Enabled = false; + } + else + { + mlTextBoxEditA.Enabled = true; + } + } + private void Initialization() + { + crownLabel宸︿笂鏈�灏忕缉鏀鹃噺.Text = (Convert.ToDouble(metroTrackBar宸︿笂鍒囩嚎缂╂斁閲�.Minimum) / 100).ToString(); + crownLabel宸︿笂鏈�澶х缉鏀鹃噺.Text = (Convert.ToDouble(metroTrackBar宸︿笂鍒囩嚎缂╂斁閲�.Maximum) / 100).ToString(); + crownLabel宸︿笅鏈�灏忕缉鏀鹃噺.Text = (Convert.ToDouble(metroTrackBar宸︿笅鍒囩嚎缂╂斁閲�.Minimum) / 100).ToString(); + crownLabel宸︿笅鏈�澶х缉鏀鹃噺.Text = (Convert.ToDouble(metroTrackBar宸︿笅鍒囩嚎缂╂斁閲�.Maximum) / 100).ToString(); + crownLabel鍙充笂鏈�灏忕缉鏀鹃噺.Text = (Convert.ToDouble(metroTrackBar鍙充笂鍒囩嚎缂╂斁閲�.Minimum) / 100).ToString(); + crownLabel鍙充笂鏈�澶х缉鏀鹃噺.Text = (Convert.ToDouble(metroTrackBar鍙充笂鍒囩嚎缂╂斁閲�.Maximum) / 100).ToString(); + crownLabel鍙充笅鏈�灏忕缉鏀鹃噺.Text = (Convert.ToDouble(metroTrackBar鍙充笅鍒囩嚎缂╂斁閲�.Minimum) / 100).ToString(); + crownLabel鍙充笅鏈�澶х缉鏀鹃噺.Text = (Convert.ToDouble(metroTrackBar鍙充笅鍒囩嚎缂╂斁閲�.Maximum) / 100).ToString(); } private void BuildIcon() { //杈撳叆妗嗗墠缂�鍥剧墖 - mlTextBoxEditR1.LeadingIcon = GlobalResource.GetLeadingIcon(); - mlTextBoxEditR2.LeadingIcon = GlobalResource.GetLeadingIcon(); + //mlTextBoxEditR1.LeadingIcon = GlobalResource.GetLeadingIcon(); + //mlTextBoxEditR2.LeadingIcon = GlobalResource.GetLeadingIcon(); mlTextBoxEdith1.LeadingIcon = GlobalResource.GetLeadingIcon(); mlTextBoxEditA.LeadingIcon = GlobalResource.GetLeadingIcon(); mlTextBoxEditL.LeadingIcon = GlobalResource.GetLeadingIcon(); mlTextBoxEditr.LeadingIcon = GlobalResource.GetLeadingIcon(); - mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.LeadingIcon = GlobalResource.GetLeadingIcon(); + mlTextBoxEditD4.LeadingIcon = GlobalResource.GetLeadingIcon(); } public bool Verify(out string error) { error = ""; bool isOk = true; - if (string.IsNullOrEmpty(mlTextBoxEditR1.Text) || mlTextBoxEditR1.Text == "璇疯緭鍏�" || double.Parse(mlTextBoxEditR1.Text) == 0) + //if (string.IsNullOrEmpty(mlTextBoxEditR1.Text) || mlTextBoxEditR1.Text == "璇疯緭鍏�" || double.Parse(mlTextBoxEditR1.Text) == 0) + //{ + // error = "璇疯緭鍏1锛�"; + // isOk = false; + // mlTextBoxEditR1.TrailingIcon = GlobalResource.GetTipTrailingIcon(); + // skyLabelR1.Visible = true; + //} + //if (string.IsNullOrEmpty(mlTextBoxEditR2.Text) || mlTextBoxEditR2.Text == "璇疯緭鍏�" || double.Parse(mlTextBoxEditR2.Text) == 0) + //{ + // error = "璇疯緭鍏2锛�"; + // isOk = false; + // mlTextBoxEditR2.TrailingIcon = GlobalResource.GetTipTrailingIcon(); + // skyLabelR2.Visible = true; + //} + if (string.IsNullOrEmpty(mlTextBoxEditD4.Text) || mlTextBoxEditD4.Text == "璇疯緭鍏�" || double.Parse(mlTextBoxEditD4.Text) == 0) { - error = "璇疯緭鍏1锛�"; + error = "璇疯緭鍏4锛�"; isOk = false; - mlTextBoxEditR1.TrailingIcon = GlobalResource.GetTipTrailingIcon(); - skyLabelR1.Visible = true; - } - if (string.IsNullOrEmpty(mlTextBoxEditR2.Text) || mlTextBoxEditR2.Text == "璇疯緭鍏�" || double.Parse(mlTextBoxEditR2.Text) == 0) - { - error = "璇疯緭鍏2锛�"; - isOk = false; - mlTextBoxEditR2.TrailingIcon = GlobalResource.GetTipTrailingIcon(); - skyLabelR2.Visible = true; - } - if (string.IsNullOrEmpty(mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.Text) || mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.Text == "璇疯緭鍏ユ墿鏁g鍑哄彛鐩村緞" || double.Parse(mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.Text) == 0) - { - error = "璇疯緭鍏ユ墿鏁g鍑哄彛鐩村緞锛�"; - isOk = false; - mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.TrailingIcon = GlobalResource.GetTipTrailingIcon(); + mlTextBoxEditD4.TrailingIcon = GlobalResource.GetTipTrailingIcon(); skyLabel鎵╂暎绠″嚭鍙g洿寰�.Visible = true; } if (string.IsNullOrEmpty(mlTextBoxEdith1.Text) || mlTextBoxEdith1.Text == "璇疯緭鍏�" || double.Parse(mlTextBoxEdith1.Text) == 0) @@ -62,9 +128,9 @@ mlTextBoxEdith1.TrailingIcon = GlobalResource.GetTipTrailingIcon(); skyLabelh1.Visible = true; } - if (string.IsNullOrEmpty(mlTextBoxEditA.Text) || mlTextBoxEditA.Text == "璇疯緭鍏�" || double.Parse(mlTextBoxEditA.Text) == 0) + if (string.IsNullOrEmpty(mlTextBoxEditA.Text) || mlTextBoxEditA.Text == "璇疯緭鍏�" ) { - error = "璇疯緭鍏2锛�"; + error = "璇疯緭鍏锛�"; isOk = false; mlTextBoxEditA.TrailingIcon = GlobalResource.GetTipTrailingIcon(); skyLabelA.Visible = true; @@ -87,87 +153,88 @@ } private void BuildAllTips() { - metroToolTip渚ч潰鍑哄彛鐩寸嚎.SetToolTip(this.mlTextBoxEditR1, "R1"); - metroToolTip渚ч潰鍑哄彛鐩寸嚎.SetToolTip(this.mlTextBoxEditR2, "R2"); + //metroToolTip渚ч潰鍑哄彛鐩寸嚎.SetToolTip(this.mlTextBoxEditR1, "R1"); + //metroToolTip渚ч潰鍑哄彛鐩寸嚎.SetToolTip(this.mlTextBoxEditR2, "R2"); metroToolTip渚ч潰鍑哄彛鐩寸嚎.SetToolTip(this.mlTextBoxEdith1, "h1"); + metroToolTip渚ч潰鍑哄彛鐩寸嚎.SetToolTip(this.mlTextBoxEdith2, "h2"); metroToolTip渚ч潰鍑哄彛鐩寸嚎.SetToolTip(this.mlTextBoxEditA, "A"); metroToolTip渚ч潰鍑哄彛鐩寸嚎.SetToolTip(this.mlTextBoxEditL, "L"); metroToolTip渚ч潰鍑哄彛鐩寸嚎.SetToolTip(this.mlTextBoxEditr, "r"); - metroToolTip渚ч潰鍑哄彛鐩寸嚎.SetToolTip(this.mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�, "鎵╂暎绠″嚭鍙g洿寰�"); + metroToolTip渚ч潰鍑哄彛鐩寸嚎.SetToolTip(this.mlTextBoxEditD4, "鎵╂暎绠″嚭鍙g洿寰�"); } - private void mlTextBoxEditR1_Enter(object sender, EventArgs e) - { - skyLabelR1.Visible = false; - mlTextBoxEditR1.TrailingIcon = null; - if (mlTextBoxEditR1.Text == "璇疯緭鍏�") - { - mlTextBoxEditR1.Text = ""; - } - } + //private void mlTextBoxEditR1_Enter(object sender, EventArgs e) + //{ + // skyLabelR1.Visible = false; + // mlTextBoxEditR1.TrailingIcon = null; + // if (mlTextBoxEditR1.Text == "璇疯緭鍏�") + // { + // mlTextBoxEditR1.Text = ""; + // } + //} - private void mlTextBoxEditR1_Leave(object sender, EventArgs e) - { - if (string.IsNullOrEmpty(mlTextBoxEditR1.Text) || double.Parse(mlTextBoxEditR1.Text) == 0) - { - mlTextBoxEditR1.Text = "璇疯緭鍏�"; - } - } + //private void mlTextBoxEditR1_Leave(object sender, EventArgs e) + //{ + // if (string.IsNullOrEmpty(mlTextBoxEditR1.Text) || double.Parse(mlTextBoxEditR1.Text) == 0) + // { + // mlTextBoxEditR1.Text = "璇疯緭鍏�"; + // } + //} - private void mlTextBoxEditR1_TextChanged(object sender, EventArgs e) - { - foreach (var s in mlTextBoxEditR1.Text) - { - if (!double.TryParse(mlTextBoxEditR1.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEditR1.Text) && mlTextBoxEditR1.Text != "璇疯緭鍏�") - { - mlTextBoxEditR1.UseAccent = true; - mlTextBoxEditR1.ShowAssistiveText = true; - mlTextBoxEditR1.Text = ""; - break; - } - else - { - mlTextBoxEditR1.ShowAssistiveText = false; - mlTextBoxEditR1.UseAccent = false; - } - } - } + //private void mlTextBoxEditR1_TextChanged(object sender, EventArgs e) + //{ + // foreach (var s in mlTextBoxEditR1.Text) + // { + // if (!double.TryParse(mlTextBoxEditR1.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEditR1.Text) && mlTextBoxEditR1.Text != "璇疯緭鍏�") + // { + // mlTextBoxEditR1.UseAccent = true; + // mlTextBoxEditR1.ShowAssistiveText = true; + // mlTextBoxEditR1.Text = ""; + // break; + // } + // else + // { + // mlTextBoxEditR1.ShowAssistiveText = false; + // mlTextBoxEditR1.UseAccent = false; + // } + // } + //} - private void mlTextBoxEditR2_Enter(object sender, EventArgs e) - { - skyLabelR2.Visible = false; - mlTextBoxEditR2.TrailingIcon = null; - if (mlTextBoxEditR2.Text == "璇疯緭鍏�") - { - mlTextBoxEditR2.Text = ""; - } - } + //private void mlTextBoxEditR2_Enter(object sender, EventArgs e) + //{ + // skyLabelR2.Visible = false; + // mlTextBoxEditR2.TrailingIcon = null; + // if (mlTextBoxEditR2.Text == "璇疯緭鍏�") + // { + // mlTextBoxEditR2.Text = ""; + // } + //} - private void mlTextBoxEditR2_Leave(object sender, EventArgs e) - { - if (string.IsNullOrEmpty(mlTextBoxEditR2.Text) || double.Parse(mlTextBoxEditR2.Text) == 0) - { - mlTextBoxEditR2.Text = "璇疯緭鍏�"; - } - } + //private void mlTextBoxEditR2_Leave(object sender, EventArgs e) + //{ + // if (string.IsNullOrEmpty(mlTextBoxEditR2.Text) || double.Parse(mlTextBoxEditR2.Text) == 0) + // { + // mlTextBoxEditR2.Text = "璇疯緭鍏�"; + // } + //} - private void mlTextBoxEditR2_TextChanged(object sender, EventArgs e) - { - foreach (var s in mlTextBoxEditR2.Text) - { - if (!double.TryParse(mlTextBoxEditR2.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEditR2.Text) && mlTextBoxEditR2.Text != "璇疯緭鍏�") - { - mlTextBoxEditR2.UseAccent = true; - mlTextBoxEditR2.ShowAssistiveText = true; - mlTextBoxEditR2.Text = ""; - break; - } - else - { - mlTextBoxEditR2.ShowAssistiveText = false; - mlTextBoxEditR2.UseAccent = false; - } - } - } + //private void mlTextBoxEditR2_TextChanged(object sender, EventArgs e) + //{ + // foreach (var s in mlTextBoxEditR2.Text) + // { + // if (!double.TryParse(mlTextBoxEditR2.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEditR2.Text) && mlTextBoxEditR2.Text != "璇疯緭鍏�") + // { + // mlTextBoxEditR2.UseAccent = true; + // mlTextBoxEditR2.ShowAssistiveText = true; + // mlTextBoxEditR2.Text = ""; + // break; + // } + // else + // { + // mlTextBoxEditR2.ShowAssistiveText = false; + // mlTextBoxEditR2.UseAccent = false; + // } + // } + //} private void mlTextBoxEdith1_Enter(object sender, EventArgs e) { @@ -204,10 +271,12 @@ mlTextBoxEdith1.UseAccent = false; } } + mlTextBoxEdith2.Text = mlTextBoxEdith1.Text; } private void mlTextBoxEditA_Enter(object sender, EventArgs e) { + skyLabelA.Visible = false; mlTextBoxEditA.TrailingIcon = null; if (mlTextBoxEditA.Text == "璇疯緭鍏�") @@ -218,7 +287,7 @@ private void mlTextBoxEditA_Leave(object sender, EventArgs e) { - if (string.IsNullOrEmpty(mlTextBoxEditA.Text) || double.Parse(mlTextBoxEditA.Text) == 0) + if (string.IsNullOrEmpty(mlTextBoxEditA.Text) ) { mlTextBoxEditA.Text = "璇疯緭鍏�"; } @@ -320,38 +389,58 @@ private void mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰刜Enter(object sender, EventArgs e) { skyLabel鎵╂暎绠″嚭鍙g洿寰�.Visible = false; - mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.TrailingIcon = null; - if (mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.Text == "璇疯緭鍏ユ墿鏁g鍑哄彛鐩村緞") + mlTextBoxEditD4.TrailingIcon = null; + if (mlTextBoxEditD4.Text == "璇疯緭鍏�") { - mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.Text = ""; + mlTextBoxEditD4.Text = ""; } } private void mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰刜Leave(object sender, EventArgs e) { - if (string.IsNullOrEmpty(mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.Text) || double.Parse(mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.Text) == 0) + if (string.IsNullOrEmpty(mlTextBoxEditD4.Text) || double.Parse(mlTextBoxEditD4.Text) == 0) { - mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.Text = "璇疯緭鍏ユ墿鏁g鍑哄彛鐩村緞"; + mlTextBoxEditD4.Text = "璇疯緭鍏�"; } } private void mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰刜TextChanged(object sender, EventArgs e) { - foreach (var s in mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.Text) + foreach (var s in mlTextBoxEditD4.Text) { - if (!double.TryParse(mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.Text) && mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.Text != "璇疯緭鍏ユ墿鏁g鍑哄彛鐩村緞") + if (!double.TryParse(mlTextBoxEditD4.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEditD4.Text) && mlTextBoxEditD4.Text != "璇疯緭鍏�") { - mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.UseAccent = true; - mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.ShowAssistiveText = true; - mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.Text = ""; + mlTextBoxEditD4.UseAccent = true; + mlTextBoxEditD4.ShowAssistiveText = true; + mlTextBoxEditD4.Text = ""; break; } else { - mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.ShowAssistiveText = false; - mlTextBoxEdit鎵╂暎绠″嚭鍙g洿寰�.UseAccent = false; + mlTextBoxEditD4.ShowAssistiveText = false; + mlTextBoxEditD4.UseAccent = false; } } } + + private void metroTrackBar宸︿笂鍒囩嚎缂╂斁閲廮Scroll(object sender) + { + crownLabel宸︿笂鍒囩嚎缂╂斁閲�.Text = (Convert.ToDouble(metroTrackBar宸︿笂鍒囩嚎缂╂斁閲�.Value) / 100).ToString(); + } + + private void metroTrackBar宸︿笅鍒囩嚎缂╂斁閲廮Scroll(object sender) + { + crownLabel宸︿笅鍒囩嚎缂╂斁閲�.Text = (Convert.ToDouble(metroTrackBar宸︿笅鍒囩嚎缂╂斁閲�.Value) / 100).ToString(); + } + + private void metroTrackBar鍙充笂鍒囩嚎缂╂斁閲廮Scroll(object sender) + { + crownLabel鍙充笂鍒囩嚎缂╂斁閲�.Text = (Convert.ToDouble(metroTrackBar鍙充笂鍒囩嚎缂╂斁閲�.Value) / 100).ToString(); + } + + private void metroTrackBar鍙充笅鍒囩嚎缂╂斁閲廮Scroll(object sender) + { + crownLabel鍙充笅鍒囩嚎缂╂斁閲�.Text = (Convert.ToDouble(metroTrackBar鍙充笅鍒囩嚎缂╂斁閲�.Value) / 100).ToString(); + } } } -- Gitblit v1.9.3