private bool ConfigCorrect() { var validator = new ConditionValidator(); validator.NonWhitespaceString(FirstPlayerNameTextBox.Text, "First player name is empty!"); validator.NonWhitespaceString(SecondPlayerNameTextBox.Text, "Second player name is empty!"); if (_firstPlayer.Type != PlayerType.Bot || _secondPlayer.Type != PlayerType.Bot) { validator.AddCondition(FirstPlayerNameTextBox.Text != SecondPlayerNameTextBox.Text, "Players must have different names"); } validator.NonWhitespaceString(FieldWidthTextBox.Text, "Width is incorrect"); validator.NonWhitespaceString(FieldHeightTextBox.Text, "Height is incorrect"); int tmp; validator.AddCondition(int.TryParse(FieldWidthTextBox.Text, out tmp), "Width is incorrect"); validator.AddCondition(tmp >= Game.VictoryLength, "Width is incorrect"); validator.AddCondition(int.TryParse(FieldHeightTextBox.Text, out tmp), "Height is incorrect"); validator.AddCondition(tmp >= Game.VictoryLength, "Height is incorrect"); if (!validator.ValidationPassed) { Helpers.ShowWarning(validator.ErrorMessage); } return(validator.ValidationPassed); }