Example #1
0
        async Task IHandleAsync <NewGameEventModel> .HandleAsync(NewGameEventModel message)
        {
            if (NewGameVM == null)
            {
                throw new BasicBlankException("New game was not even active.  Therefore, I should not have received message for requesting new game");
            }
            if (AlwaysNewGame == false)
            {
                await CloseSpecificChildAsync(NewGameVM);

                NewGameVM = null;//forgot to set to null.
            }
            if (MainVM != null)
            {
                await CloseSpecificChildAsync(MainVM);
            }
            MainVM = null; //looks like i have to set to null manually.
            //i think i should load it again anyways (?) and set the old to nothing.  so a fresh one will be created.
            //maybe we don't need the update code but we still need the load processes.
            //since we have code for closing, hopefully i am not forced to figure out how to delete controls (?)
            await _saves.DeleteSinglePlayerGameAsync(); //i think.

            await NewGameRequestedAsync();
            await StartNewGameAsync();
        }
Example #2
0
        /// <summary>
        /// this is when somebody chooses new game.
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        async Task IHandleAsync <NewGameEventModel> .HandleAsync(NewGameEventModel message)
        {
            await PrepNewGameAsync();

            if (_test.AlwaysNewGame)
            {
                CommandContainer.ClearLists(); //try this too.
                await _save.DeleteGameAsync(); //i think.

                ReplaceGame();                 //try this too.
                //other things are needed here too.
            }

            if (NewGameScreen == null)
            {
                throw new BasicBlankException("New game was not even active.  Therefore, I should not have received message for requesting new game");
            }

            await CloseMainAsync("Should have shown main game when showing new game.");

            //i think i should load it again anyways (?) and set the old to nothing.  so a fresh one will be created.
            //maybe we don't need the update code but we still need the load processes.
            //since we have code for closing, hopefully i am not forced to figure out how to delete controls (?)
            await _save.DeleteGameAsync(); //i think.

            await CloseSpecificChildAsync(NewGameScreen);

            NewGameScreen = null;//forgot to set to null.
            await NewGameOrRoundRequestedAsync();

            if (_mainGame == null)
            {
                throw new BasicBlankException("Failed to replace game when requesting new game.  Rethink");
            }
            //can't load here because it thinks you have the old file (wrong).

            //await LoadGameScreenAsync(); //i think in this case, should load here.

            IRequestNewGameRound gameRound = MainContainer.Resolve <IRequestNewGameRound>();
            await gameRound.RequestNewGameAsync();
        }