using DPumpHydr.WinFrmUI.RLT.Controls;
|
using DPumpHydr.WinFrmUI.Volute.ViewModel;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
|
namespace DPumpHydr.WinFrmUI.Volute
|
{
|
public partial class sidelineExitControl : UserControl
|
{
|
public sidelineExitControl()
|
{
|
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();
|
mlTextBoxEdith1.LeadingIcon = GlobalResource.GetLeadingIcon();
|
mlTextBoxEditA.LeadingIcon = GlobalResource.GetLeadingIcon();
|
mlTextBoxEditL.LeadingIcon = GlobalResource.GetLeadingIcon();
|
mlTextBoxEditr.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)
|
//{
|
// error = "请输入R1!";
|
// isOk = false;
|
// mlTextBoxEditR1.TrailingIcon = GlobalResource.GetTipTrailingIcon();
|
// skyLabelR1.Visible = true;
|
//}
|
//if (string.IsNullOrEmpty(mlTextBoxEditR2.Text) || mlTextBoxEditR2.Text == "请输入" || double.Parse(mlTextBoxEditR2.Text) == 0)
|
//{
|
// error = "请输入R2!";
|
// isOk = false;
|
// mlTextBoxEditR2.TrailingIcon = GlobalResource.GetTipTrailingIcon();
|
// skyLabelR2.Visible = true;
|
//}
|
if (string.IsNullOrEmpty(mlTextBoxEditD4.Text) || mlTextBoxEditD4.Text == "请输入" || double.Parse(mlTextBoxEditD4.Text) == 0)
|
{
|
error = "请输入D4!";
|
isOk = false;
|
mlTextBoxEditD4.TrailingIcon = GlobalResource.GetTipTrailingIcon();
|
skyLabel扩散管出口直径.Visible = true;
|
}
|
if (string.IsNullOrEmpty(mlTextBoxEdith1.Text) || mlTextBoxEdith1.Text == "请输入" || double.Parse(mlTextBoxEdith1.Text) == 0)
|
{
|
error = "请输入h1!";
|
isOk = false;
|
mlTextBoxEdith1.TrailingIcon = GlobalResource.GetTipTrailingIcon();
|
skyLabelh1.Visible = true;
|
}
|
if (string.IsNullOrEmpty(mlTextBoxEditA.Text) || mlTextBoxEditA.Text == "请输入" )
|
{
|
error = "请输入A!";
|
isOk = false;
|
mlTextBoxEditA.TrailingIcon = GlobalResource.GetTipTrailingIcon();
|
skyLabelA.Visible = true;
|
}
|
if (string.IsNullOrEmpty(mlTextBoxEditL.Text) || mlTextBoxEditL.Text == "请输入" || double.Parse(mlTextBoxEditL.Text) == 0)
|
{
|
error = "请输入L!";
|
isOk = false;
|
mlTextBoxEditL.TrailingIcon = GlobalResource.GetTipTrailingIcon();
|
skyLabelL.Visible = true;
|
}
|
if (string.IsNullOrEmpty(mlTextBoxEditr.Text) || mlTextBoxEditr.Text == "请输入" || double.Parse(mlTextBoxEditr.Text) == 0)
|
{
|
error = "请输入r!";
|
isOk = false;
|
mlTextBoxEditr.TrailingIcon = GlobalResource.GetTipTrailingIcon();
|
skyLabelr.Visible = true;
|
}
|
return isOk;
|
}
|
private void BuildAllTips()
|
{
|
//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.mlTextBoxEditD4, "扩散管出口直径");
|
}
|
//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_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_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 mlTextBoxEdith1_Enter(object sender, EventArgs e)
|
{
|
skyLabelh1.Visible = false;
|
mlTextBoxEdith1.TrailingIcon = null;
|
if (mlTextBoxEdith1.Text == "请输入")
|
{
|
mlTextBoxEdith1.Text = "";
|
}
|
}
|
|
private void mlTextBoxEdith1_Leave(object sender, EventArgs e)
|
{
|
if (string.IsNullOrEmpty(mlTextBoxEdith1.Text) || double.Parse(mlTextBoxEdith1.Text) == 0)
|
{
|
mlTextBoxEdith1.Text = "请输入";
|
}
|
}
|
|
private void mlTextBoxEdith1_TextChanged(object sender, EventArgs e)
|
{
|
foreach (var s in mlTextBoxEdith1.Text)
|
{
|
if (!double.TryParse(mlTextBoxEdith1.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEdith1.Text) && mlTextBoxEdith1.Text != "请输入")
|
{
|
mlTextBoxEdith1.UseAccent = true;
|
mlTextBoxEdith1.ShowAssistiveText = true;
|
mlTextBoxEdith1.Text = "";
|
break;
|
}
|
else
|
{
|
mlTextBoxEdith1.ShowAssistiveText = false;
|
mlTextBoxEdith1.UseAccent = false;
|
}
|
}
|
mlTextBoxEdith2.Text = mlTextBoxEdith1.Text;
|
}
|
|
private void mlTextBoxEditA_Enter(object sender, EventArgs e)
|
{
|
|
skyLabelA.Visible = false;
|
mlTextBoxEditA.TrailingIcon = null;
|
if (mlTextBoxEditA.Text == "请输入")
|
{
|
mlTextBoxEditA.Text = "";
|
}
|
}
|
|
private void mlTextBoxEditA_Leave(object sender, EventArgs e)
|
{
|
if (string.IsNullOrEmpty(mlTextBoxEditA.Text) )
|
{
|
mlTextBoxEditA.Text = "请输入";
|
}
|
}
|
|
private void mlTextBoxEditA_TextChanged(object sender, EventArgs e)
|
{
|
foreach (var s in mlTextBoxEditA.Text)
|
{
|
if (!double.TryParse(mlTextBoxEditA.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEditA.Text) && mlTextBoxEditA.Text != "请输入")
|
{
|
mlTextBoxEditA.UseAccent = true;
|
mlTextBoxEditA.ShowAssistiveText = true;
|
mlTextBoxEditA.Text = "";
|
break;
|
}
|
else
|
{
|
mlTextBoxEditA.ShowAssistiveText = false;
|
mlTextBoxEditA.UseAccent = false;
|
}
|
}
|
}
|
|
private void mlTextBoxEditL_Enter(object sender, EventArgs e)
|
{
|
skyLabelL.Visible = false;
|
mlTextBoxEditL.TrailingIcon = null;
|
if (mlTextBoxEditL.Text == "请输入")
|
{
|
mlTextBoxEditL.Text = "";
|
}
|
}
|
|
private void mlTextBoxEditL_Leave(object sender, EventArgs e)
|
{
|
if (string.IsNullOrEmpty(mlTextBoxEditL.Text) || double.Parse(mlTextBoxEditL.Text) == 0)
|
{
|
mlTextBoxEditL.Text = "请输入";
|
}
|
}
|
|
private void mlTextBoxEditL_TextChanged(object sender, EventArgs e)
|
{
|
foreach (var s in mlTextBoxEditL.Text)
|
{
|
if (!double.TryParse(mlTextBoxEditL.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEditL.Text) && mlTextBoxEditL.Text != "请输入")
|
{
|
mlTextBoxEditL.UseAccent = true;
|
mlTextBoxEditL.ShowAssistiveText = true;
|
mlTextBoxEditL.Text = "";
|
break;
|
}
|
else
|
{
|
mlTextBoxEditL.ShowAssistiveText = false;
|
mlTextBoxEditL.UseAccent = false;
|
}
|
}
|
}
|
|
private void mlTextBoxEditr_Enter(object sender, EventArgs e)
|
{
|
skyLabelr.Visible = false;
|
mlTextBoxEditr.TrailingIcon = null;
|
if (mlTextBoxEditr.Text == "请输入")
|
{
|
mlTextBoxEditr.Text = "";
|
}
|
}
|
|
private void mlTextBoxEditr_Leave(object sender, EventArgs e)
|
{
|
if (string.IsNullOrEmpty(mlTextBoxEditr.Text) || double.Parse(mlTextBoxEditr.Text) == 0)
|
{
|
mlTextBoxEditr.Text = "请输入";
|
}
|
}
|
|
private void mlTextBoxEditr_TextChanged(object sender, EventArgs e)
|
{
|
foreach (var s in mlTextBoxEditr.Text)
|
{
|
if (!double.TryParse(mlTextBoxEditr.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEditr.Text) && mlTextBoxEditr.Text != "请输入")
|
{
|
mlTextBoxEditr.UseAccent = true;
|
mlTextBoxEditr.ShowAssistiveText = true;
|
mlTextBoxEditr.Text = "";
|
break;
|
}
|
else
|
{
|
mlTextBoxEditr.ShowAssistiveText = false;
|
mlTextBoxEditr.UseAccent = false;
|
}
|
}
|
}
|
|
private void mlTextBoxEdit扩散管出口直径_Enter(object sender, EventArgs e)
|
{
|
skyLabel扩散管出口直径.Visible = false;
|
mlTextBoxEditD4.TrailingIcon = null;
|
if (mlTextBoxEditD4.Text == "请输入")
|
{
|
mlTextBoxEditD4.Text = "";
|
}
|
}
|
|
private void mlTextBoxEdit扩散管出口直径_Leave(object sender, EventArgs e)
|
{
|
if (string.IsNullOrEmpty(mlTextBoxEditD4.Text) || double.Parse(mlTextBoxEditD4.Text) == 0)
|
{
|
mlTextBoxEditD4.Text = "请输入";
|
}
|
}
|
|
private void mlTextBoxEdit扩散管出口直径_TextChanged(object sender, EventArgs e)
|
{
|
foreach (var s in mlTextBoxEditD4.Text)
|
{
|
if (!double.TryParse(mlTextBoxEditD4.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEditD4.Text) && mlTextBoxEditD4.Text != "请输入")
|
{
|
mlTextBoxEditD4.UseAccent = true;
|
mlTextBoxEditD4.ShowAssistiveText = true;
|
mlTextBoxEditD4.Text = "";
|
break;
|
}
|
else
|
{
|
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();
|
}
|
}
|
}
|