Exemple #1
0
        //Constructs the main window
        public MainWindow()
        {
            counter = 0;
            InitializeComponent();

            backgroundCombobox      = new Backgrounds();
            popupFullImageWindow    = new FullImage();
            popupPuzzlePiecesWindow = new Puzzle_Pieces();

            dt.Tick           += new EventHandler(dt_Tick);
            dt.Interval        = new TimeSpan(0, 0, 0, 0, 1);
            clocktxtblock.Text = "00:00";

            #region put tiles in a list

            //Put image tiles in an array
            // Method: 15 Puzzles
            puzzle = new Puzzle(Puzzle.StartType.Random, this);

            for (byte i = 0; i < 15; ++i)
            {
                BitmapImage temp = new BitmapImage();
                temp.BeginInit();
                temp.UriSource = new Uri("Tiles/Cute_Cat_" + (i + 1).ToString() + ".png", UriKind.Relative);
                temp.EndInit();
                tiles[i]        = new Image();
                tiles[i].Source = temp;
                tiles[i].Width  = puzzleCanvas.Width / 4.27;
                tiles[i].Height = puzzleCanvas.Height / 4.27;
                puzzleCanvas.Children.Add(tiles[i]);
                referencePuzzle[i] = new Image();
            }

            ChangeTilesPositions();
            #endregion
        }
Exemple #2
0
        /*For future coding. Supposed to give a choice of number of tiles.
         * Para: event on click button
         * Return: None
         */
        private void mouseclick(object sender, MouseButtonEventArgs e)
        {
            Puzzle_Pieces popupPuzzleWindow = new Puzzle_Pieces();

            popupPuzzleWindow.Show();
        }