Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void idc_Changed(object sender, EventArgs e)
- {
- InputDigitControl idc = (InputDigitControl)sender;
- string fldID = idc.Name.Substring(3, 1);
- double V = TemperatureConvert.ToDouble(idc.Text);
- switch (fldID)
- {
- case "C":
- {
- if (!enC) return;
- if (V < -273.15)
- {
- lblError.Text = "Такой температуры не бывает!";
- return;
- }
- idcK.Text = TemperatureConvert.C2K(V).ToString();
- idcF.Text = TemperatureConvert.C2F(V).ToString();
- lblError.Text = "";
- }; break;
- case "K":
- {
- if (!enK) return;
- idcC.Text = TemperatureConvert.K2C(V).ToString();
- idcF.Text = TemperatureConvert.K2F(V).ToString();
- }; break;
- case "F":
- {
- if (!enF) return;
- if (V < -459.67)
- {
- lblError.Text = "Такой температуры не бывает!";
- return;
- }
- idcC.Text = TemperatureConvert.F2C(V).ToString();
- idcK.Text = TemperatureConvert.F2K(V).ToString();
- lblError.Text = "";
- }; break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement