public Form1() { InitializeComponent(); this.blankPipe = new Pipes(); this.pipe = new Pipes(); this.textBoxInput = new TextBoxInputHendler(); if (BearingsRadioButton.Checked == true) { this.blankPipe.stellGrade = StellGrades.Bearings; this.blankPipe.empiricalCoefficient = BallBearingEmpiricalCoefficient; this.pipe.stellGrade = StellGrades.Bearings; this.pipe.empiricalCoefficient = BallBearingEmpiricalCoefficient; } }
private void PipesDimentionsWarningMessagesHendler(Pipes pipe, Label warningMessage, TextBox textBoxResult) { warningMessage.ResetText(); if (pipe.diameter == 0.00 && pipe.side == 0.00) { textBoxResult.Text = InitialTextBoxValue; pipe.weightOfMeter = 0.00; } else if (pipe.diameter == 0.00 && pipe.side != 0.00) { warningMessage.Left = 30; warningMessage.Top = 50; warningMessage.Text = "Диаметр не может\nравняться 0"; textBoxResult.Text = InitialTextBoxValue; pipe.weightOfMeter = 0.00; } else if (pipe.diameter != 0.00 && pipe.side == 0.00) { warningMessage.Left = 155; warningMessage.Top = 50; warningMessage.Text = "Стенка не может\nравняться 0"; textBoxResult.Text = InitialTextBoxValue; pipe.weightOfMeter = 0.00; } else if (!pipe.CheckRatioOfDiameterToSide()) { warningMessage.Left = 15; warningMessage.Top = 55; warningMessage.Text = "Диаметр (D) должен быть больше стенки (S) * 2"; textBoxResult.Text = InitialTextBoxValue; pipe.weightOfMeter = 0.00; } else if (pipe.CheckRatioOfDiameterToSide()) { warningMessage.ResetText(); textBoxResult.Text = pipe.CalculatePipesOneMetereWeight().ToString("0.00"); } }