lixiaojun
2024-07-11 8d8cd298ab46aee191baf53ff320fd3290d1ec9a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
namespace IStation.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 (IStation.WinFrmUI.Localization.IsCN)
            //    return;
 
            //this.label叶轮直径.Text = IStation.WinFrmUI.Localization.TranslateHelper.GetString("叶轮直径");
            //this.label泵的子型号.Text = IStation.WinFrmUI.Localization.TranslateHelper.GetString("泵的子型号");
            //this.btnAdd.Text = IStation.WinFrmUI.Localization.TranslateHelper.GetString("添加");
            //this.btnCancel.Text = IStation.WinFrmUI.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 = "\"";
             
        }
    }
}