public MainWindow() { InitializeComponent(); TextWindow tw = new TextWindow(); tw.Show(); ListSwapRackButton = new List <Button>(); RackTileButtons = new List <Button>(); // Adding board buttons for (int i = 0; i < 15; ++i) { for (int j = 0; j < 15; ++j) { Button b = new Button(); b.Click += Copier; b.FontSize = 33; BoardGrid.Children.Add(b); b.Content = '\0'; b.Background = BoardTiles.DetermineColor(i, j); BoardButtons[i, j] = b; //Binding bind = new Binding(); //Console.Write("\"BTD{0}{1}\",", (char)(i + 65), j.ToString()); //bind.Path = new PropertyPath("BTD{0}{1}", (char)(i + 65), j.ToString()); //bind.Mode = BindingMode.OneWay; //bind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; //BindingOperations.SetBinding(b, Button.ContentProperty, bind); //b.SetBinding(Button.CommandProperty, new Binding("ClickBoardTile")); } } // Adding rack buttons for (int i = 0; i < 7; ++i) { Button t = new Button(); t.Click += Poster; t.FontSize = 33; HandGrid.Children.Add(t); t.Background = Brushes.Chocolate; t.Content = '\0'; RackTileButtons.Add(t); //bind bind = new Binding(); //bind.Path = new PropertyPath("RackTileDisplay"); //bind.Mode = BindingMode.OneWay; //t.SetBinding(Button.CommandProperty, new Binding("ClickRackTile")); //bind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; //BindingOperations.SetBinding(t, Button.ContentProperty, bind); } game = new Game(); LogBoardWriter(Welcome.WelcomeText); ValidateButton.IsEnabled = false; StorageLbl.Content = '\0'; }
private void Button_Click(object sender, RoutedEventArgs e) { int cnt = 0; foreach (ComboBox c in Interfaces.Children) { ComboBoxItem ci = c.SelectedItem as ComboBoxItem; if (ci != null && ci.ToString() != "") { cnt++; } } if (cnt >= 2) { GameState.GSInstance.Initialise(cnt); int P = 0; Game g = new Game(); // Controller foreach (ComboBox c in Interfaces.Children) { ComboBoxItem ci = c.SelectedItem as ComboBoxItem; if (ci == null) { continue; } if (ci.Content.ToString() == "Desktop") { DesktopWindow dw = new DesktopWindow(P, g); dw.Show(); P++; } else if (ci.Content.ToString() == "Text") { TextWindow tw = new TextWindow(P, g); tw.Show(); P++; } else if (ci.Content.ToString() == "Mobile") { MobileWindow mw = new MobileWindow(P, g); mw.Show(); P++; } } this.Close(); } else { MessageBox.Show("You need more friends to start Scrabble!!!", "Find friends!"); } }