private void OnClickPlate(object sender, PlateEventArgs e)
        {
            // Opens requested plate through simulating Button Click
            string btnName = "Button";

            if (e.PlateRow < 10)
            {
                btnName += String.Format("0{0}", e.PlateRow);
            }
            else
            {
                btnName += String.Format("{0:D2}", e.PlateRow);
            }
            if (e.PlateColumn < 10)
            {
                btnName += String.Format("0{0}", e.PlateColumn);
            }
            else
            {
                btnName += String.Format("{0:D2}", e.PlateColumn);
            }


            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());
        }
Ejemplo n.º 2
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);
            }
        }