예제 #1
0
        protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
        {
            if (e.Uri.ToString() == "app://external/")
            {
                this.SaveState(IsolatedStorageFileNameKey, MainViewModel.Instance.IsolatedStorageFileName);
                this.SaveState(GameModeKey, MainViewModel.Instance.GameMode);

                // save game specific state
                MatchingGameViewModel matchingGame = MainViewModel.Instance.CurrentView as MatchingGameViewModel;

                int[]  cardsOrder;
                bool[] cardsUseDuplicate;
                bool[] cardsIsMatched;
                bool[] cardsIsSelected;
                matchingGame.GetGameState(out cardsOrder, out cardsUseDuplicate, out cardsIsMatched, out cardsIsSelected);

                this.SaveState(CardsOrderKey, cardsOrder);
                this.SaveState(CardsUseDuplicateKey, cardsUseDuplicate);
                this.SaveState(CardsIsMatchedKey, cardsIsMatched);
                this.SaveState(CardsIsSelectedKey, cardsIsSelected);
            }
        }