private float GetLeft(PrivateBasicIndividualPileWPF <CA, GC, GW> thisPile) { var firstLocation = thisPile.CardLocation; firstLocation.X += Spacing; firstLocation.Y += Spacing; float thisLeft = 0; float pileWidth; pileWidth = (float)thisPile.ActualWidth; if (Grid.GetColumn(thisPile) == 0) { thisLeft = firstLocation.X; } else { var loopTo = _thisMod !.Columns - 1; for (var x = 1; x <= loopTo; x++) { thisLeft += pileWidth + Spacing + Spacing; if (Grid.GetColumn(thisPile) == x) { break; } } } return(thisLeft); }
private SKPoint GetBottomLocation(PrivateBasicIndividualPileWPF <CA, GC, GW> thisPile) { var thisHeight = _thisCanvas !.ActualHeight; var thisLeft = GetLeft(thisPile); return(new SKPoint(thisLeft, (float)thisHeight)); }
private SKPoint GetStartLocation(PrivateBasicIndividualPileWPF <CA, GC, GW> thisPile) // i do because i need to know the height. { var thisHeight = thisPile.ActualHeight; // i think. well see how that is done for xamarin forms (we seemed to do it successfully from xamarin forms var thisLeft = GetLeft(thisPile); return(new SKPoint(thisLeft, (float)thisHeight * -1.0f)); // i think }
private SKPoint GetObjectLocation(PrivateBasicIndividualPileWPF <CA, GC, GW> thisPile) { var firstLocation = thisPile.CardLocation; firstLocation.X += Spacing; firstLocation.Y += Spacing; float pileHeight; pileHeight = (float)thisPile.ActualHeight; float pileWidth; pileWidth = (float)thisPile.ActualWidth; if (Grid.GetRow(thisPile) == 0 && Grid.GetColumn(thisPile) == 0) { return(firstLocation);// its that simple because its the first column and first row } float thisLeft = 0; float thisTop = 0; int x; if (Grid.GetRow(thisPile) == 0) { thisTop = firstLocation.Y; } else { var loopTo = _thisMod !.Rows - 1; for (x = 1; x <= loopTo; x++) { thisTop += pileHeight + Spacing + Spacing; // not built in afterall. if (Grid.GetRow(thisPile) == x) { break; } } } if (Grid.GetColumn(thisPile) == 0) { thisLeft = firstLocation.X; } else { var loopTo1 = _thisMod !.Columns - 1; for (x = 1; x <= loopTo1; x++) { thisLeft += pileWidth + Spacing + Spacing; if (Grid.GetColumn(thisPile) == x) { break; } } } return(new SKPoint(thisLeft, thisTop)); }
public void UpdateLists(BasicMultiplePilesCP <CA> mod) { _thisMod = mod; DataContext = null; DataContext = _thisMod; _thisGrid !.Children.Clear(); //i think this is best. GridHelper.AddAutoColumns(_thisGrid, _thisMod.Columns); GridHelper.AddAutoRows(_thisGrid, _thisMod.Rows); foreach (var pileMod in _thisMod.PileList !) { PrivateBasicIndividualPileWPF <CA, GC, GW> PileG = new PrivateBasicIndividualPileWPF <CA, GC, GW>(); PileG.MainMod = _thisMod; PileG.ThisPile = pileMod; GridHelper.AddControlToGrid(_thisGrid, PileG, pileMod.Row - 1, pileMod.Column - 1); PileG.Margin = new Thickness(Spacing, Spacing, Spacing, Spacing); PileG.Init(_tagUsed); } }
public void Init(BasicMultiplePilesCP <CA> mod, string tagUsed) { _thisGrid = new Grid(); _parentGrid = new Grid(); _parentGrid.Children.Add(_thisGrid); _thisMod = mod; DataContext = mod; // i think needs this as well. _tagUsed = tagUsed; GW tempCard = new GW(); tempCard.SendSize(tagUsed, new CA()); //for testing. SKSize size = tempCard.ObjectSize; if (_thisMod.PileList !.Count == 0) { throw new BasicBlankException("Must have at least one pile. Otherwise, not worth even using this"); } if (_thisMod.HasFrame) { GridHelper.AddAutoColumns(_thisGrid, _thisMod.Columns); GridHelper.AddAutoRows(_thisGrid, _thisMod.Rows); } else { _thisMod.Columns.Times(x => { GridHelper.AddPixelColumn(_thisGrid, size.Width); }); _thisMod.Rows.Times(x => { GridHelper.AddPixelRow(_thisGrid, size.Height); }); } foreach (var pileMod in _thisMod.PileList) { PrivateBasicIndividualPileWPF <CA, GC, GW> pileG = new PrivateBasicIndividualPileWPF <CA, GC, GW>(); pileG.MainMod = _thisMod; pileG.ThisPile = pileMod; GridHelper.AddControlToGrid(_thisGrid, pileG, pileMod.Row - 1, pileMod.Column - 1); pileG.Margin = new Thickness(Spacing, Spacing, Spacing, Spacing); pileG.Init(tagUsed); } Content = _parentGrid; }