Exemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            // When the timer ticks, clear the content
            this.timer.Tick += (timerSender, timerEvents) =>
            {
                sbLabel.Content = "";
                this.timer.Stop();
            };

            // Setup menu of different versions
            {
                for (int i = 0; i < Card.NUM_DECKS_AVAILABLE; i++)
                {
                    Decks deck = (Decks)(1UL << i);

                    var name = deck.ToString().Replace("__", " ").Replace("_", ".");
                    var mi   = new MenuItem()
                    {
                        Header           = name,
                        IsCheckable      = true,
                        StaysOpenOnClick = true,
                        Tag       = deck,
                        IsChecked = (i == 0)
                    };

                    mi.Click += (miSender, miEventArgs) =>
                    {
                        sbLabel.Content = "Deck setting updated. Start a new game from the File menu to effect the change.";
                        timer.Start();
                    };

                    FileDecks.Items.Add(mi);
                }
            }
        }