using System; using System.Windows.Forms; namespace TProduct.WinFrmUI { public partial class InputSimuCurveParasDlg : Form { public InputSimuCurveParasDlg() { InitializeComponent(); } public double GetParaValue() { if (this._isMeter) { return textPara.GetValue(); } else { return textPara.GetValue() * 25.4; } } public void SetParaValue(double ParaValue) { if (this._isMeter) { textPara.SetValue(ParaValue); } else { textPara.SetValue(ParaValue / 25.4); } } public void IsSpeedCurve() { this._isMeter = true; label叶轮直径.Text = "转速"; labelUnit.Text = "rpm"; } public string GetPumpCode() { return textBox泵的子型号.Text; } public void SetPumpCode(string PumpCode) { textBox泵的子型号.Text = PumpCode; } public string GetPartNO() { return textBox物料代码.Text; } public void SetPartNO(string PartNO) { textBox物料代码.Text = PartNO; } //不用输入型号 public void SetNoInputCode() { label泵的子型号.Visible = textBox泵的子型号.Visible = false; } // private void btnAdd_Click(object sender, EventArgs e) { if (Math.Abs(GetParaValue() - Convert.ToDouble(textPara.Properties.MaxValue)) < 0.01) { MessageBox.Show("不能是原始直径"); return; } this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } private void btnCancel_Click(object sender, EventArgs e) { this.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.Close(); } private void onDlg_Load(object sender, EventArgs e) { LocationDialog(); } //翻译界面语言 private void LocationDialog() { //if (TProduct.UserSetting.Localization.IsCN) // return; //this.label叶轮直径.Text = TProduct.UserSetting.Localization.TranslateHelper.GetString("叶轮直径"); //this.label泵的子型号.Text = TProduct.UserSetting.Localization.TranslateHelper.GetString("泵的子型号"); //this.btnAdd.Text = TProduct.UserSetting.Localization.TranslateHelper.GetString("添加"); //this.btnCancel.Text = TProduct.UserSetting.Localization.TranslateHelper.GetString("取消" ); } public void SetRanglePara(double minV, double maxV) { if (this._isMeter) { textPara.Properties.MinValue = Convert.ToDecimal(minV); textPara.Properties.MaxValue = Convert.ToDecimal(maxV); } else { textPara.Properties.MinValue = Convert.ToDecimal(minV / 25.4); textPara.Properties.MaxValue = Convert.ToDecimal(maxV / 25.4); } } bool _isMeter = true; public void SetUnit(bool isMeter) { this._isMeter = isMeter; if (isMeter) labelUnit.Text = "mm"; else labelUnit.Text = "\""; } } }