public void Init(SolitairePilesCP thisMod) { _thisStack = new StackPanel(); HorizontalAlignment = HorizontalAlignment.Left; VerticalAlignment = VerticalAlignment.Top; _thisStack.Orientation = Orientation.Horizontal; ScrollViewer thisScroll = new ScrollViewer(); thisScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; thisScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled; _thisMod = thisMod; if (thisMod.PileList.Count == 0) { throw new BasicBlankException("Must have at least one pile. Otherwise, not worth even using this"); } thisMod.PileList.ForEach(thisPile => { IndividualSolitairePileWPF thisG = new IndividualSolitairePileWPF(); thisG.MainMod = thisMod; thisG.ThisPile = thisPile; thisG.Margin = new Thickness(0, 0, Spacing, 0); _thisStack.Children.Add(thisG); thisG.Init(); }); thisScroll.Content = _thisStack; Content = thisScroll; }
public void Init(SolitairePilesCP mod, BasicMultiplePilesWPF <SolitaireCard, ts, DeckOfCardsWPF <SolitaireCard> > thisMain) { _thisMod = mod; if (_thisMod.PileList.Count != 8) { throw new BasicBlankException("Must have 8 piles"); } _thisGrid = new Grid(); AddAutoRows(_thisGrid, 4); AddLeftOverColumn(_thisGrid, 40); AddAutoColumns(_thisGrid, 1); AddLeftOverColumn(_thisGrid, 40); AddControlToGrid(_thisGrid, thisMain, 0, 1); Grid.SetRowSpan(thisMain, 4); //all 4 for main. int x; for (x = 1; x <= 4; x++) { var thisSingle = new SinglePileUI(); var thisPile = _thisMod.PileList[x - 1]; thisSingle.Init(thisPile, _thisMod); // the first 4 are reversed AddControlToGrid(_thisGrid, thisSingle, x - 1, 0); } for (x = 5; x <= 8; x++) { var thisSingle = new SinglePileUI(); var thisPile = _thisMod.PileList[x - 1]; thisSingle.Init(thisPile, _thisMod); //no reverse anymore. thisSingle.Margin = new Thickness(20, 0, 0, 0); AddControlToGrid(_thisGrid, thisSingle, x - 5, 2); } Content = _thisGrid; }
//private readonly IBasicGameVM _thisMod; public WastePilesCP(CommandContainer command, IEventAggregator aggregator) { Piles = new SolitairePilesCP(command); Piles.DoubleClickedAsync += Piles_DoubleClickedAsync; Piles.ColumnClickedAsync += Piles_ColumnClickedAsync; _command = command; _aggregator = aggregator; }
public void Init(PileInfoCP singlePile, SolitairePilesCP main) { MouseUp += SinglePileUI_MouseUp; _mainMod = main; _thisMod = singlePile; _thisMod.PropertyChanged += PropertyChanged; _cardList = singlePile.CardList; _cardList.CollectionChanged += CollectionChanged; Background = Brushes.Transparent; //this was required too. _thisGrid = new Grid(); Content = _thisGrid; var tempCard = GetNewCard(new SolitaireCard()); _widthUsed = tempCard.ObjectSize.Width; //needs this so we know. PopulateControls(); }
public void Init(SolitairePilesCP thisMod) { _thisStack = new StackLayout(); SolitaireCard card = new SolitaireCard(); DeckOfCardsXF <SolitaireCard> temps = new DeckOfCardsXF <SolitaireCard>(); temps.SendSize(ts.TagUsed, card); var size = temps.Measure(double.PositiveInfinity, double.PositiveInfinity); if (size.Request.Height == 0 || size.Request.Width == 0) { throw new BasicBlankException("Was unable to get the width or height request. Rethink"); } else { SolitaireOverlapLayoutXF.MinWidth = size.Request.Width + 9; } _thisStack.Orientation = StackOrientation.Horizontal; _thisStack.Spacing = 0; ScrollView thisScroll = new ScrollView(); thisScroll.Orientation = ScrollOrientation.Horizontal; _thisMod = thisMod; if (thisMod.PileList.Count == 0) { throw new BasicBlankException("Must have at least one pile. Otherwise, not worth even using this"); } thisMod.PileList.ForEach(thisPile => { IndividualSolitairePileXF thisG = new IndividualSolitairePileXF(); thisG.MainMod = thisMod; thisG.ThisPile = thisPile; thisG.Margin = new Thickness(0, 0, 0, 0); //try this _thisStack.Children.Add(thisG); thisG.Init(_needsPopulating); }); _needsPopulating = false; thisScroll.Content = _thisStack; Content = thisScroll; }
public void Init(PileInfoCP singlePile, SolitairePilesCP main) { Grid otherGrid = new Grid(); _mainMod = main; _thisMod = singlePile; //hopefully property change just works right (?) _thisMod.PropertyChanged += SinglePileUI_PropertyChanged; _cardList = singlePile.CardList; _cardList.CollectionChanged += CollectionChanged; _thisGrid = new Grid(); _thisGrid.InputTransparent = true; otherGrid.Children.Add(_thisGrid); _thisControl = new SKCanvasView(); _thisControl.EnableTouchEvents = true; _thisControl.Touch += TouchEvent; otherGrid.Children.Add(_thisControl); Content = otherGrid; var tempCard = GetNewCard(new SolitaireCard()); _widthUsed = tempCard.ObjectSize.Width; //needs this so we know. PopulateControls(); }