Ejemplo n.º 1
0
        public void Populate(int chosen)
        {
            SetObjects();
            if (_list.Count == 0)
            {
                //await UIPlatform.ShowMessageAsync("Populating cards");
                GenerateList();
            }
            var item = _list.GetSpecificItem(chosen);

            Deck     = chosen;
            Suit     = item.Suit;
            Section  = item.Section;
            Value    = item.Value;
            Color    = item.Color;
            CardType = item.CardType;
            FinishPopulatingCard();
        }
Ejemplo n.º 2
0
        public async Task <DeckObservableDict <D> > GetListFromJsonAsync(string jsonData)
        {
            bool doRedo = RedoList();
            CustomBasicList <int> thisList = await js.DeserializeObjectAsync <CustomBasicList <int> >(jsonData);

            CustomBasicList <D> tempList = new CustomBasicList <D>();

            if (doRedo == true)
            {
                thisList.ForEach(Items =>
                {
                    D thisD = new D();
                    _beforePopulate !.Invoke(thisD); //sometimes something has to be done before the card can be populated.
                    thisD.Populate(Items);
                    tempList.Add(thisD);
                });
                _privateDict.AddRange(tempList, System.Collections.Specialized.NotifyCollectionChangedAction.Add);
                return(new DeckObservableDict <D>(tempList));
            }
            if (_privateDict.Count == thisList.Count)
            {
                FixObjects();
                DeckRegularDict <D> newTemp = new DeckRegularDict <D>(_privateDict);
                thisList.ForEach(Items =>
                {
                    tempList.Add(newTemp.GetSpecificItem(Items));
                });
                _privateDict.ReplaceRange(tempList);
                return(new DeckObservableDict <D>(tempList));
            }
            UnlinkObjects();
            thisList.ForEach(items =>
            {
                D thisD          = _privateDict.GetSpecificItem(items);
                thisD.Visible    = true;
                thisD.IsEnabled  = true;
                thisD.IsUnknown  = false;
                thisD.IsSelected = false;
                thisD.Drew       = false;
                tempList.Add(thisD);
            });
            return(new DeckObservableDict <D>(tempList));
        }