Beispiel #1
0
 public void UpdateList(RummyDiceHandVM thisMod)
 {
     BindingContext = null;
     BindingContext = thisMod;
     _thisMod       = thisMod;
     _handList !.CollectionChanged -= HandList_CollectionChanged;
     _handList = thisMod.HandList; //rehook up again.
     PopulateControls();
 }
Beispiel #2
0
        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;
        }
Beispiel #3
0
        public void LoadList(RummyDiceHandVM thisMod, RummyDiceMainGameClass mainGame)
        {
            _thisMod                     = thisMod;
            _mainGame                    = mainGame;
            BindingContext               = thisMod;
            HorizontalOptions            = LayoutOptions.FillAndExpand; //hopefully this works too.
            _handList                    = thisMod.HandList;
            _handList.CollectionChanged += HandList_CollectionChanged;
            Text = $"Temp Set {thisMod.Index}";
            SetBinding(IsEnabledProperty, new Binding(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 CustomProportionXF();
            SKSize           firstSize = new SKSize(firstDice.HeightWidth, firstDice.HeightWidth);
            var sizeUsed = firstSize.GetSizeUsed(thisI.Proportion);

            Margin                 = new Thickness(3, 3, 3, 3);
            _thisStack             = new StackLayout();
            _thisStack.Orientation = StackOrientation.Horizontal;
            _thisStack.Spacing     = 0;
            Button thisBut = GetSmallerButton("Place Tiles", "");

            thisBut.Command = thisMod.BoardCommand; //i think this way this time.
            StackLayout finalStack = new StackLayout();

            finalStack.Orientation = StackOrientation.Horizontal;
            finalStack.Children.Add(thisBut);
            finalStack.Spacing = 2;
            finalStack.Children.Add(_thisStack);
            thisBut.HorizontalOptions    = LayoutOptions.Start;
            thisBut.VerticalOptions      = LayoutOptions.Start;
            _thisStack.HorizontalOptions = LayoutOptions.FillAndExpand;
            thisBut.FontSize            *= .7f;
            _thisGrid = new Grid();
            _thisGrid.Children.Add(ThisDraw);
            _thisGrid.Children.Add(finalStack);
            var thisRect = ThisFrame.GetControlArea();

            thisBut.Margin    = new Thickness(thisRect.Left + 3, thisRect.Top + 10, 3, 3);
            _thisStack.Margin = new Thickness(thisRect.Left + 3, thisRect.Top + 10, 3, 3);
            PopulateControls(); //just in case there is something to start with.
            Content = _thisGrid;
        }