Example #1
0
 private void SaveHands()
 {
     List<BothHands> handhistory = (List<BothHands>)App.settings["handhistory"];
     BothHands bothhands = new BothHands { OpeningHand = HandStart, ClosingHand = HandEnd, GameType = GameType, CreditCount = (int)App.settings["credits"], IsSnapped=false, IsOnline=false};
     handhistory.Add(bothhands);
     App.settings["handhistory"] = handhistory;
     App.SaveOldHandData();
 }
Example #2
0
        private async void SaveHands()
        {
            StorageFile file = await App.files.CreateFileAsync("handhistory2.txt", CreationCollisionOption.OpenIfExists);
            string handtext = await FileIO.ReadTextAsync(file);
            List<BothHands> handhistory = JsonConvert.DeserializeObject<List<BothHands>>(handtext);
            if (handhistory == null) handhistory = new List<BothHands>();
            BothHands bothhands = new BothHands { OpeningHand = HandStart, ClosingHand = HandEnd, GameType = GameType, CreditCount = (int)App.settings.Values["credits"], IsOnline = false, IsSnapped = IsSnapped };
            handhistory.Add(bothhands);
            handtext = JsonConvert.SerializeObject(handhistory);

            file = await App.files.CreateFileAsync("handhistory2.txt", CreationCollisionOption.ReplaceExisting);
            await FileIO.WriteTextAsync(file, handtext);
            App.UpdateLiveTiles(HandEnd.Check(GameType), GameType);
            if (App.settings.Values["microsoftuserid"].ToString().Contains("MicrosoftAccount"))
            {
                App.SaveOldHandData();
            }
        }