public static async Task <GameDescriptionAndRating> GetGameConfigFomServer(AppDataContext appDataContext)
        {
            JsonObject jsonParameter = ToJsonForGetExpansions(appDataContext);
            string     parameter     = jsonParameter.Stringify();

            var fullUrl = new System.Text.StringBuilder();

            fullUrl.Append(WebService.webUrl);
            fullUrl.Append("?action=GET&values=");
            fullUrl.Append(parameter.Replace(" ", "%20"));

            try
            {
                using (var client = new Windows.Web.Http.HttpClient())
                    using (var request = new Windows.Web.Http.HttpRequestMessage())
                    {
                        request.RequestUri = new System.Uri(fullUrl.ToString());
                        using (Windows.Web.Http.HttpResponseMessage responseMessage = await client.SendRequestAsync(request).AsTask())
                        {
                            if (responseMessage.IsSuccessStatusCode)
                            {
                                string strResult = await responseMessage.Content.ReadAsStringAsync().AsTask();

                                GameDescriptionAndRating description = WebService.GetGameDescriptionFromJson(strResult);
                                System.Diagnostics.Debug.WriteLine("Get Response from server:");
                                System.Diagnostics.Debug.WriteLine(strResult);
                                return(description);
                            }
                        }
                    }
            } catch (System.Exception)
            {
            }
            return(null);
        }
        public void Randomize10Cards()
        {
            var currentDeckSelectedItems = this.CurrentCardsListView.SelectedItems.Select(item => (DominionCard)item).ToArray <DominionCard>();
            var baneSelectedItems        = this.BaneCardsListView.SelectedItems.Select(item => (DominionCard)item).ToArray <DominionCard>();
            var eventsSelectedItems      = this.EventCardsListView.SelectedItems.Select(item => (DominionCard)item).ToArray <DominionCard>();

            bool isReplacing = currentDeckSelectedItems.Any() || baneSelectedItems.Any() || eventsSelectedItems.Any();
            bool isReducing  = this.appDataContext.CurrentDeck.CurrentCards.Count() > 10 && currentDeckSelectedItems.Any();
            bool isGrowing   = this.appDataContext.CurrentDeck.CurrentCards.Count() < 10 && this.appDataContext.CurrentDeck.CurrentCards.Any();

            if (!isReplacing && !isGrowing && !isReducing)
            {
                // clean roll
                this.appDataContext.player1Strategy.Clear();
                this.appDataContext.player2Strategy.Clear();
                this.appDataContext.UpdateSimulationStep();
                this.appDataContext.CurrentDeck.ReapplySortOrder();

                if (this.appDataContext.GetDecksFromWeb.Value)
                {
                    var uiScheduler = System.Threading.Tasks.TaskScheduler.FromCurrentSynchronizationContext();
                    WebService.GetGameConfigFomServer(this.appDataContext).ContinueWith(descrTask =>
                    {
                        GameDescriptionAndRating gameDescriptionAndRating = descrTask.Result;
                        if (gameDescriptionAndRating != null)
                        {
                            this.appDataContext.PopulateFromGameDescription(gameDescriptionAndRating.gameDescription);
                            this.appDataContext.WebRating.Value  = (int)(gameDescriptionAndRating.rating + 0.5);
                            this.appDataContext.DeckRating.Value = 0;
                        }
                        else
                        {
                            GenerateRandomDeck();
                        }
                    }, uiScheduler);
                }
                else
                {
                    GenerateRandomDeck();
                }
            }
            else
            {
                this.appDataContext.CurrentDeck.CopyOrder();
                DominionCard baneCard    = this.appDataContext.BaneCard.CurrentCards.FirstOrDefault();
                bool         isCleanRoll = this.appDataContext.CurrentDeck.GenerateRandom(10, ref baneCard, this.appDataContext.AllCards.CurrentCards, itemsToReplace: currentDeckSelectedItems);
                this.appDataContext.BaneCard.PopulateBaneCard(baneCard);
                this.appDataContext.DeckRating.Value = 0;
                this.appDataContext.WebRating.Value  = 0;
            }

            string jsonDescription = WebService.ToJson(this.appDataContext.GetGameConfig().gameDescription, 5).Stringify();

            System.Diagnostics.Debug.WriteLine("New Kingdom");
            System.Diagnostics.Debug.WriteLine("===========");
            System.Diagnostics.Debug.WriteLine(jsonDescription);

            if (this.CurrentCardsChanged != null)
            {
                this.CurrentCardsChanged();
            }
        }