/// <summary> /// Create the grid the grid depends of the puzzle 4,9,16 pieces /// </summary> /// <param name="mw"></param> public void createGrid(PuzzleGame mw) { this.mw = mw; int numPiece = 1; for (int i = 0; i < n; i++) { ColumnDefinition gridCol1 = new ColumnDefinition(); RowDefinition gridRow1 = new RowDefinition(); this.gridMatriz.ColumnDefinitions.Add(gridCol1); this.gridMatriz.RowDefinitions.Add(gridRow1); } for (int i = 0; i < this.gridMatriz.RowDefinitions.Count; i++) { for (int j = 0; j < this.gridMatriz.ColumnDefinitions.Count; j++) { PiecePuzzle piece = new PiecePuzzle(); piece.Control = this.conPuz; piece.Num = numPiece; numPiece++; Grid.SetRow(piece, i); Grid.SetColumn(piece, j); this.gridMatriz.Children.Add(piece); } } this.sourceImage(); }
/// <summary> /// The user select the difficulty /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void selectPuzzle(object sender, RoutedEventArgs e) { this.sensorChooser.Stop(); this.Hide(); int aux = Int32.Parse(((KinectTileButton)sender).Tag.ToString()); PuzzleGame mw = new PuzzleGame(aux, this); mw.Show(); }