public void LoadList(RummyDiceHandVM thisMod, RummyDiceMainGameClass mainGame) { _thisMod = thisMod; _mainGame = mainGame; DataContext = thisMod; _handList = thisMod.HandList; _handList.CollectionChanged += HandList_CollectionChanged; Text = $"Temp Set {thisMod.Index}"; SetBinding(IsEnabledProperty, nameof(RummyDiceHandVM.IsEnabled)); RummyDiceInfo firstDice = new RummyDiceInfo(); if (firstDice.HeightWidth == 0) { throw new BasicBlankException("You must specify the height/width of the dice"); } IProportionImage thisI = new CustomProportionWPF(); SKSize firstSize = new SKSize(firstDice.HeightWidth, firstDice.HeightWidth); var sizeUsed = firstSize.GetSizeUsed(thisI.Proportion); Grid firstGrid = new Grid(); GridHelper.AddPixelRow(firstGrid, (int)sizeUsed.Height + 50); GridHelper.AddLeftOverRow(firstGrid, 1); Margin = new Thickness(3, 3, 3, 3); _thisStack = new StackPanel(); _thisStack.Orientation = Orientation.Horizontal; Button thisBut = GetGamingButton("Place Tiles", nameof(RummyDiceHandVM.BoardCommand)); //i think since its a different view model, has to do manually. thisBut.Name = ""; thisBut.Command = thisMod.BoardCommand; thisBut.Margin = new Thickness(5, 5, 5, 5); GridHelper.AddControlToGrid(firstGrid, _thisStack, 0, 0); GridHelper.AddControlToGrid(firstGrid, thisBut, 1, 0); _thisGrid = new Grid(); //hopefully does not need visible. if we need visible, rethink. //SetBinding(VisibilityProperty, GetVisibleBinding(nameof(RummyDiceHandVM.Visible))); _thisGrid.Children.Add(ThisDraw); _thisGrid.Children.Add(firstGrid); var thisRect = ThisFrame.GetControlArea(); _thisStack.Margin = new Thickness(thisRect.Left + 3, thisRect.Top + 10, 3, 3); Width = 1520; //different on xamarin forms. Height = 250; PopulateControls(); //just in case there is something to start with. Content = _thisGrid; }
public void SendDiceInfo(RummyDiceInfo thisDice, RummyBoardCP board) { _mains = new RummyDiceGraphicsCP(this); _board = board; MouseUp += RummyDiceGraphicsWPF_MouseUp; _mains.MinimumWidthHeight = thisDice.HeightWidth; SetBinding(IsSelectedProperty, new Binding(nameof(RummyDiceInfo.IsSelected))); //maybe i forgot this too. SetBinding(VisibilityProperty, new Binding(nameof(RummyDiceInfo.Visible))); //i think. SetBinding(ColorProperty, new Binding(nameof(RummyDiceInfo.Color))); SetBinding(ValueProperty, new Binding(nameof(RummyDiceInfo.Display))); //decided to bind to display now. SKSize tempSize = new SKSize(thisDice.HeightWidth, thisDice.HeightWidth); IProportionImage thisP = new CustomProportionWPF(); SKSize diceSize = tempSize.GetSizeUsed(thisP.Proportion); DataContext = thisDice; Height = diceSize.Height; Width = diceSize.Width; Init(); }