Esempio n. 1
0
 private void PileList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if ((int)e.Action == (int)NotifyCollectionChangedAction.Reset)
     {
         _thisStack !.Children.Clear(); // hopefully this simple (nothing else).  well see
         return;
     }
     if ((int)e.Action == (int)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 == (int)NotifyCollectionChangedAction.Add)
     {
         foreach (var thisItem in e.NewItems)
         {
             var thisPile = (BasicPileInfo <FlinchCardInformation>)thisItem !;
             IndividualPileWPF thisCon = new IndividualPileWPF();
             thisCon.ThisPile = thisPile;
             thisCon.MainMod  = _thisMod;
             thisCon.Init();
             _thisStack !.Children.Add(thisCon);
         }
         return;
     }
 }
Esempio n. 2
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)
     {
         IndividualPileWPF thisCon = new IndividualPileWPF();
         thisCon.ThisPile = thisPile;
         thisCon.MainMod  = _thisMod;
         thisCon.Init(); // i think i needed this as well
         _thisStack.Children.Add(thisCon);
     }
 }
Esempio n. 3
0
        private SKPoint GetCardLocation(IndividualPileWPF 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");
            }
            int maxColumns;

            maxColumns       = _thisCanvas !.ActualWidth.RoundToLowerNumber();
            var(row, column) = GetRowColumn(thisIndex, maxColumns);
            var thisHeight = _thisStack.ItemHeight * row;
            var thisWidth  = _thisStack.ItemWidth * column;

            return(new SKPoint((float)thisWidth, (float)thisHeight));
        }
Esempio n. 4
0
        public void Init(PublicPilesViewModel mod)
        {
            _thisMod    = mod;
            _parentGrid = new Grid();
            _thisStack  = new WrapPanel();
            var tempCard = new FlinchCardInformation();
            var thisP    = Resolve <IProportionImage>();

            _thisStack.ItemHeight  = tempCard.DefaultSize.Height * thisP.Proportion;
            _thisStack.ItemWidth   = tempCard.DefaultSize.Width * thisP.Proportion;
            _thisStack.Orientation = Orientation.Horizontal; // start out horizontally
            _pileList = _thisMod.PileList;                   // i think its that simple.
            _pileList.CollectionChanged += PileList_CollectionChanged;
            foreach (var thisPile in _pileList)
            {
                IndividualPileWPF thisCon = new IndividualPileWPF();
                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;
        }