void UpdateCAProperties() { byte rule; if (!byte.TryParse(byteRuleNumberBox.Text, out rule)) { currentProperty = CAProperty.Empty; } int length; if (!int.TryParse(lengthBox.Text, out length)) { currentProperty = CAProperty.Empty; } if (length < 3) { length = 3; } double density; if (!double.TryParse(densityBox.Text, out density)) { currentProperty = CAProperty.Empty; } int time; if (!int.TryParse(timeBox.Text, out time)) { currentProperty = CAProperty.Empty; } currentProperty = new CAProperty(rule, length, density, time); lengthBox.Text = length.ToString(); }
static CAProperty() { _empty = new CAProperty(0, 0, 0, 0); }
void UpdateCAProperties() { byte rule; if (!byte.TryParse(byteRuleNumberBox.Text, out rule)) currentProperty = CAProperty.Empty; int length; if (!int.TryParse(lengthBox.Text, out length)) currentProperty = CAProperty.Empty; if (length < 3) length = 3; double density; if (!double.TryParse(densityBox.Text, out density)) currentProperty = CAProperty.Empty; int time; if (!int.TryParse(timeBox.Text, out time)) currentProperty = CAProperty.Empty; currentProperty = new CAProperty(rule, length, density, time); lengthBox.Text = length.ToString(); }