private string GetResultValue(InputPanel element) { if ( double.TryParse(element.LengthNumeric.Value.ToString(), out double resultLength) && double.TryParse(element.WidthNumeric.Value.ToString(), out double resultWidth) && double.TryParse(FloorLengthTextBox.Text, out double floorLength) && double.TryParse(FloorWidthTextBox.Text, out double floorWidth) ) { double result; if ( !(element.InputNameLbl.Text.Equals("Carpet") || element.InputNameLbl.Text.Equals("Linoleum")) ) { result = Round(floorLength / resultLength) * Round(floorWidth / resultWidth); return($"{result} pcs."); } result = Round(floorLength) * Round(floorWidth / resultWidth); return($"{result} m."); } return("Invalid input data!"); }
private void GetInputUserControl(string coverageTypeName, CheckBox coverageTypeCheckBox) { InputPanel tmpUserControlPanel; if (coverageTypeCheckBox.Checked) { tmpUserControlPanel = new InputPanel(); tmpUserControlPanel.InputNameLbl.Text = coverageTypeName; if (coverageTypeName == "Carpet" || coverageTypeName == "Linoleum") { tmpUserControlPanel.LengthNumeric.Visible = false; tmpUserControlPanel.LengthLbl.Visible = false; } tmpUserControlPanel.Location = new Point(0, InputLevel * 75); _inputPanel.Add(tmpUserControlPanel); InputPanel.Controls.Add(tmpUserControlPanel); return; } var getPanelForDelete = _inputPanel.FirstOrDefault(panel => panel.InputNameLbl.Text.Equals(coverageTypeName)); if (getPanelForDelete != null) { InputPanel.Controls.Remove(getPanelForDelete); _inputPanel.Remove(getPanelForDelete); RefreshState(); } }