private void btnPredict_Click(object sender, EventArgs e) { Color eye = colorPickerEye.SelectedItem == null ? Color.Empty : colorPickerEye.SelectedItem.Color; Color tounge = colorPickerTougue.SelectedItem == null ? Color.Empty : colorPickerTougue.SelectedItem.Color; Color wound = colorPickerWound.SelectedItem == null ? Color.Empty : colorPickerWound.SelectedItem.Color; List <string> snakes = PredictSnake.GetInstance().GetSnake(eye, tounge, wound, new List <string>(Regex.Split(txtSwell.Text, Environment.NewLine)), new List <string>(Regex.Split(txtSymp.Text, Environment.NewLine))); if (snakes.ToArray().Count() == 0) { MessageBox.Show("Unable to Determine Snake"); } // else if (snakes.ToArray().Count() == 1) // { // SnakeInfo win = new SnakeInfo(snakes.First()); // LoadPage(win); // } else { /*string message = "More than one snake match the search." + Environment.NewLine + "Probale snakes: " + snakes.Aggregate((prev, next) => prev + " or " + next); * if (MessageBox.Show(message, "Multiple possiblities", MessageBoxButtons.OKCancel) == DialogResult.OK) * { * foreach (string snake in snakes) * { * SnakeInfo win = new SnakeInfo(snake); * win.Show(); * } * }*/ SnakeInfo win = new SnakeInfo(snakes.First()); LoadPage(win); } }
public static PredictSnake GetInstance() { //Singleton if (instance == null) { instance = new PredictSnake(); } return(instance); }