public GameWindow(Grille customGrid) { // Assigne notre game grid au customGrid this.gameGrid = customGrid; InitializeComponent(); // Met le titre approprié lblTitle.Content = gameGrid.Title; ListWordsToFind = new ObservableCollection <string>(); cellSize = grdLettres.Height / gameGrid.GridSize; StrikethroughDrawing.SizeOfCell = cellSize; // Remplis notre grid et les listes. FillGridWithCells(); sizeOfLetter = DetermineSizeOfLetters(); heightOfLetter = DetermineHeightOfLetters(); sizeOfWord = DetermineSizeOfWords(); FillGridWithLetters(); FillListMots(); // Crerr notre premier polygone currentPolygon = new Polygon() { Stroke = new SolidColorBrush(Colors.Black), StrokeThickness = 2 }; // Rajoute-le dans notre canvas. cnvPolygone.Children.Add(currentPolygon); // Pour databind notre OvservableCollection. this.DataContext = this; StartArrowAnimation(); }
private void GridSizeButton_Clicked(object sender, RoutedEventArgs e) { int gridSize = Convert.ToInt32((sender as Button).Tag); List <Grille> gridPool = GetGridPool(gridSize); Grille selectedGrid = gridPool[gen.Next(0, gridPool.Count)]; GameWindow wndGame = new GameWindow(selectedGrid); wndGame.Show(); this.Close(); }
private void GridSizeButton_Clicked(object sender, RoutedEventArgs e) { int gridSize = Convert.ToInt32((sender as Button).Tag); List <Grille> gridPool = GetGridPool(gridSize); Grille selectedGrid = gridPool[gen.Next(0, gridPool.Count)]; wndGame = new GameWindow(selectedGrid); wndGame.Show(); // Ferme notre premiere fenetre, le MainMenu window. Application.Current.Windows[0].Close(); }