private void materialRaisedButton1_Click(object sender, EventArgs e) { //if(validationString.ElementAt(currStringIndex)) if (validationString.Length > 0) { targetArrow = null; if (currentState != null) { foreach (Arrow arrow in currentState.exitArrowList) { foreach (String str in arrow.getDelta()) { if (str.CompareTo("" + validationString[currStringIndex]) == 0) { targetArrow = arrow; break; } } if (targetArrow != null) { break; } } } if (targetArrow != null) { currentState = targetArrow.toState; } else { currentState = null; } if (currentState == null) { materialRaisedButton1.Enabled = false; displayMessageBox("String not accepted"); } else { if (materialCheckBox1.Checked) { speech.Speak(targetArrow.fromState.stateName + " on " + Char.ToUpper(validationString[currStringIndex]) + " goes to " + targetArrow.toState.stateName); } processedString = processedString + validationString[currStringIndex]; if (currStringIndex + 1 != validationString.Length) { currStringIndex++; } else if (currentState.final) { materialRaisedButton1.Enabled = false; displayMessageBox("String accepted"); } else { materialRaisedButton1.Enabled = false; displayMessageBox("String not accepted"); } } drawPanel1.Invalidate(); } }