Пример #1
0
        public void show_flag(int x, int y, Button_states state)
        {
            // Flagge auf Feld anzeigen
            switch (state)
            {
            case Button_states.opened:
                // keine Flagge, da schon geoeffnet
                break;

            case Button_states.not_marked:
                // keine Flagge
                buttons[x, y].Text  = "";
                buttons[x, y].Image = null;
                break;

            case Button_states.marked:
                // rote Flagge
                buttons[x, y].Text  = "";
                buttons[x, y].Image = flag_img;
                break;

            case Button_states.maybe_marked:
                // blaue Flagge
                buttons[x, y].Text  = "";
                buttons[x, y].Image = flag_img2;
                break;

            default:
                // sollte nicht erreicht werden
                break;
            }
        }
 public void open()
 {
     if (state == Button_states.not_marked)
     {
         state = Button_states.opened;
     }
 }
        // Zustanduebergangsmethoden
        public void mark()
        {
            switch (state)
            {
            case Button_states.opened:
                break;

            case Button_states.not_marked:
                state = Button_states.marked;
                break;

            case Button_states.marked:
                state = Button_states.maybe_marked;
                break;

            case Button_states.maybe_marked:
                state = Button_states.not_marked;
                break;

            default:
                // sollte nicht erreicht werden
                break;
            }
        }