Beispiel #1
0
        private void menuLoad_Click(object sender, RoutedEventArgs e)
        {
            int  currentStage = theGame.Stage;
            bool loaded       = GameSaver.LoadGame(ref theGame);

            if (loaded)
            {
                try
                {
                    //theGame = new Game(loaded);
                    this.menuSave.IsEnabled = true;
                    string stageName     = "GuessMyCard.Stage" + theGame.Stage;
                    Type   elementType   = Type.GetType(stageName);
                    object stageInstance = Activator.CreateInstance(elementType);
                    Page   stage         = (Page)stageInstance;
                    PageSwitcher.Switch(this, stage);
                    theGame.StartLoadedStage(stage, theGame.StagePiles);
                    UpdateLoadedStatusBar(currentStage, theGame.Stage);
                }
                catch
                {
                    MessageBox.Show("Dane w pliku były niepoprawne");
                }
            }
        }
Beispiel #2
0
        private void menuNew_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("Think of a card from Nine to Ace along with its suit", "Before going further...");
            this.menuSave.IsEnabled = true;
            Stage1 stage1 = new Stage1();

            PageSwitcher.Switch(this, stage1);
            theGame = new Game();
            theGame.StartStage(stage1, 4);
            UpdateStatusBar(theGame.Stage);
        }
Beispiel #3
0
        private void stage1buttton_Click(object sender, RoutedEventArgs e)
        {
            string buttonNumber = (sender as Button).Name.Substring(7, 1);

            theGame.PickedPile = Int32.Parse(buttonNumber);
            theGame.Stage      = 2;
            Stage2 stage2 = new Stage2();

            PageSwitcher.Switch(this, stage2);
            theGame.StartStage(stage2, 3);
            UpdateStatusBar(theGame.Stage);
        }
Beispiel #4
0
 public MainWindow()
 {
     InitializeComponent();
     WindowAdjust();
     PageSwitcher.Switch(this, new StartingPage());
 }