Exemplo n.º 1
0
 public void UpdateList(GameBoardObservable <CA> mod)
 {
     _thisMod    = mod;
     DataContext = null;
     DataContext = _thisMod;
     _objectList !.CollectionChanged -= ObjectList_CollectionChanged;
     _objectList = mod.ObjectList;
     _mainGrid !.ColumnDefinitions.Clear();
     _mainGrid.RowDefinitions.Clear();
     SetUpGrid();
     _objectList.CollectionChanged += ObjectList_CollectionChanged;
     PopulateList(); //i think.
 }
Exemplo n.º 2
0
        public void LoadList(GameBoardObservable <CA> mod, string tagUsed)
        {
            _tagUsed       = tagUsed;
            _thisMod       = mod;
            BindingContext = _thisMod;
            _objectList    = _thisMod.ObjectList;
            _objectList.CollectionChanged += ObjectList_CollectionChanged;
            Grid firstGrid = new Grid();

            if (_thisMod.HasFrame == true)
            {
                firstGrid.Children.Add(ThisDraw);
            }
            _mainGrid = new Grid();
            _mainGrid.ColumnSpacing = 0;
            _mainGrid.RowSpacing    = 0;
            firstGrid.Children.Add(_mainGrid);
            var firstCard = new CA(); // for size

            if (firstCard.DefaultSize.Height == 0 || firstCard.DefaultSize.Width == 0)
            {
                throw new BasicBlankException("The width and height must be greater than 0 when initializging hand wpf");
            }
            IGamePackageResolver thisR = (IGamePackageResolver)cons !;
            IProportionImage     thisI = thisR.Resolve <IProportionImage>(tagUsed);

            _sizeUsed = firstCard.DefaultSize.GetSizeUsed(thisI.Proportion);
            SetBinding(TextProperty, new Binding(nameof(GameBoardObservable <CA> .Text)));
            SetBinding(IsEnabledProperty, new Binding(nameof(GameBoardObservable <CA> .IsEnabled)));
            SetBinding(IsVisibleProperty, new Binding(nameof(GameBoardObservable <CA> .Visible)));
            SetUpGrid();
            var tempWidth  = _sizeUsed.Width * _thisMod.Columns;
            var tempHeight = _sizeUsed.Height * _thisMod.Rows;

            if (_thisMod.HasFrame == true)
            {
                SetUpMarginsOnParentControl(_mainGrid);
            }
            float tops  = (float)_mainGrid.Margin.Top + (float)_mainGrid.Margin.Bottom;
            float lefts = (float)_mainGrid.Margin.Left + (float)_mainGrid.Margin.Right;

            HeightRequest = tempHeight + tops;
            WidthRequest  = tempWidth + lefts;
            PopulateList();
            Content = firstGrid;
        }
Exemplo n.º 3
0
        public void LoadList(GameBoardObservable <CA> mod, string tagUsed)
        {
            _tagUsed    = tagUsed;
            _thisMod    = mod;
            DataContext = _thisMod;
            _objectList = _thisMod.ObjectList;
            _objectList.CollectionChanged += ObjectList_CollectionChanged;
            Grid firstGrid = new Grid();

            if (_thisMod.HasFrame == true)
            {
                firstGrid.Children.Add(ThisDraw);
            }
            _mainGrid = new Grid();
            firstGrid.Children.Add(_mainGrid);
            var firstCard = new CA(); // for size

            if (firstCard.DefaultSize.Height == 0 || firstCard.DefaultSize.Width == 0)
            {
                throw new BasicBlankException("The width and height must be greater than 0 when initializging hand wpf");
            }
            IGamePackageResolver thisR = (IGamePackageResolver)cons !;
            IProportionImage     thisI = thisR.Resolve <IProportionImage>(tagUsed);

            _sizeUsed = firstCard.DefaultSize.GetSizeUsed(thisI.Proportion);
            SetUpGrid();
            PopulateList();
            SetBinding(TextProperty, nameof(GameBoardObservable <CA> .Text));
            SetBinding(IsEnabledProperty, nameof(GameBoardObservable <CA> .IsEnabled));
            SetBinding(VisibilityProperty, GetVisibleBinding(nameof(GameBoardObservable <CA> .Visible)));
            if (_thisMod.HasFrame == true)
            {
                var thisRect = ThisFrame.GetControlArea();
                _mainGrid.Margin = new Thickness(thisRect.Left + 3, thisRect.Top + 3, 3, 5); // try this way.
            }
            Content = firstGrid;
        }