Exemplo n.º 1
0
        // Kliknięcie do otwarcia pojedynczej komórki - automatyczne by otworzyć wszystkie puste komórki w okolicy tej pojedynczej
        protected virtual void OnClickPlate(PlateEventArgs e)
        {
            EventHandler <PlateEventArgs> handler = ClickPlate;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemplo n.º 2
0
        private void OnClickPlate(object sender, PlateEventArgs e)
        {
            // Opens requested plate through simulating Button Click
            string btnName = "Button";

            if (Mines.Width <= 10 && Mines.Height <= 10)
            {
                btnName += String.Format("{0:D1}{1:D1}", e.PlateRow, e.PlateColumn);                                          // one digit coordinates
            }
            else
            {
                btnName += String.Format("{0:D2}{1:D2}", e.PlateRow, e.PlateColumn);  // two digits coordinates
            }
            Button senderButton = (ButtonsGrid.FindName(btnName) as Button);

            if (senderButton == null)
            {
                throw new MinesweeperException("Invalid Button to MinesGrid reference on multiple reveal");                       // the plate refers to an invalid button
            }
            // calls respecive "Button Click" event handler
            this.Button_Click(senderButton, new RoutedEventArgs());
        }
Exemplo n.º 3
0
        private void OnClickPlate(object sender, PlateEventArgs e)
        {
            string btnName = "Button";

            if (Mines.Width <= 10 && Mines.Height <= 10)
            {
                btnName += String.Format("{0:D1}{1:D1}", e.PlateRow, e.PlateColumn);
            }
            else
            {
                btnName += String.Format("{0:D2}{1:D2}", e.PlateRow, e.PlateColumn);
            }

            Button senderButton = (ButtonsGrid.FindName(btnName) as Button);

            if (senderButton == null)
            {
                throw new MinesweeperException("Invalid Button to MinesGrid reference on multiple reveal");
            }

            this.Button_Click(senderButton, new RoutedEventArgs());
        }
Exemplo n.º 4
0
        private void OnClickPlate(object sender, PlateEventArgs e)
        {
            // Opens requested plate through simulating Button Click
            string btnName = "Button";
            if (Mines.Width <= 10 && Mines.Height <= 10) btnName += String.Format("{0:D1}{1:D1}", e.PlateRow, e.PlateColumn); // one digit coordinates
            else btnName += String.Format("{0:D2}{1:D2}", e.PlateRow, e.PlateColumn); // two digits coordinates

            Button senderButton = (ButtonsGrid.FindName(btnName) as Button);
            if (senderButton == null) throw new MinesweeperException("Invalid Button to MinesGrid reference on multiple reveal"); // the plate refers to an invalid button

            // calls respecive "Button Click" event handler
            this.Button_Click(senderButton, new RoutedEventArgs());
        }
Exemplo n.º 5
0
 // "Click to Reveal Plate" Event Raiser - used to automatically open all empty plates in a region
 protected virtual void OnClickPlate(PlateEventArgs e)
 {
     EventHandler<PlateEventArgs> handler = ClickPlate;
     if (handler != null)
     {
         handler(this, e);
     }
 }