예제 #1
0
 private void PileList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Reset)
     {
         _thisStack !.Children.Clear(); // hopefully this simple (nothing else).  well see
         return;
     }
     if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         // this means one got removed.  for this, will only remove one alone.
         foreach (var thisItem in e.OldItems)
         {
             var thisPile = (BasicPileInfo <FlinchCardInformation>)thisItem !;
             var thisCon  = FindControl(thisPile);
             _thisStack !.Children.Remove(thisCon);
         }
         return;
     }
     if (e.Action == NotifyCollectionChangedAction.Add)
     {
         foreach (var thisItem in e.NewItems)
         {
             var thisPile             = (BasicPileInfo <FlinchCardInformation>)thisItem !;
             IndividualPileXF thisCon = new IndividualPileXF();
             thisCon.ThisPile = thisPile;
             thisCon.MainMod  = _thisMod;
             thisCon.Init();
             _thisStack !.Children.Add(thisCon);
         }
         return;
     }
 }
예제 #2
0
        private SKPoint GetCardLocation(IndividualPileXF thisControl) // harder
        {
            var thisIndex = _thisStack !.Children.IndexOf(thisControl);

            if (thisIndex == -1)
            {
                throw new BasicBlankException("It should have found the card location for the individual control for animations");
            }
            return(new SKPoint(_sizeUsed.Width * thisIndex, 0));
        }
예제 #3
0
 public void UpdateLists(PublicPilesViewModel mod)
 {
     _thisMod = mod;
     _thisStack !.Children.Clear(); //best to just redo this time.
     _pileList !.CollectionChanged -= PileList_CollectionChanged;
     _pileList = _thisMod.PileList;
     _pileList.CollectionChanged += PileList_CollectionChanged;
     foreach (var thisPile in _pileList)
     {
         IndividualPileXF thisCon = new IndividualPileXF();
         thisCon.ThisPile = thisPile;
         thisCon.MainMod  = _thisMod;
         thisCon.Init(); // i think i needed this as well
         _thisStack.Children.Add(thisCon);
     }
 }
예제 #4
0
        public void Init(PublicPilesViewModel mod)
        {
            _thisMod    = mod;
            _parentGrid = new Grid();
            _thisStack  = new StackLayout();
            var tempCard = new FlinchCardInformation();
            var thisP    = Resolve <IProportionImage>();

            _sizeUsed = tempCard.DefaultSize.GetSizeUsed(thisP.Proportion);
            _thisStack.Orientation = StackOrientation.Horizontal; // start out horizontally
            _pileList = _thisMod.PileList;                        // i think its that simple.
            _pileList.CollectionChanged += PileList_CollectionChanged;
            HeightRequest = _sizeUsed.Height;
            foreach (var thisPile in _pileList)
            {
                IndividualPileXF thisCon = new IndividualPileXF();
                thisCon.ThisPile = thisPile;
                thisCon.MainMod  = _thisMod;
                thisCon.Init(); // i think i needed this as well
                _thisStack.Children.Add(thisCon);
            }
            _parentGrid.Children.Add(_thisStack);
            Content = _parentGrid;
        }