private void startGameButton_Click(object sender, RoutedEventArgs e) { parent.Children.Remove(parent.Children[1]); //hostCanvas List<TextBox> tbList = new List<TextBox>(7); List<ComboBox> cbList = new List<ComboBox>(7); List<Player> players = new List<Player>(); input = this.tb.Text; UIElementCollection c = waitingCanvas.Children; //System.Console.WriteLine("\n\n\n"); for (int i = 0; i < c.Count; i++) { UIElement el = c[i]; if (c[i].GetType() == typeof(System.Windows.Controls.ComboBox)) cbList.Add((ComboBox)c[i]); if (c[i].GetType() == typeof(System.Windows.Controls.TextBox)) tbList.Add((TextBox)c[i]); } for (int i = 0; i < tbList.Count; i++) { ComboBox cb = null; TextBox tb = tbList[i]; if (tb.Text.Length != 0 && tb.Text != " ") { cb = this.getComboBox(cbList, tb.Name.Substring(4, 1)); players.Add(new Player(i, cb.SelectedIndex)); } } if (players.Count < 3) { System.Windows.MessageBox.Show("C'mon you need at least three players!"); WaitingToStartCanvasHost wait = new WaitingToStartCanvasHost(parent); } else { StartGame start = new StartGame(players); //TODO NETWORKING need a text field input of how many players are connected //Just read the text fields?...Accumulate GameState game = start.getGame(); List<PlayerState> ps = game.getPlayers(); PlayerGameBoard play = new PlayerGameBoard(parent, ps[0], game);//this creates the canvas that shows. //TODO need to make child 0 player and child 1 current view. } }