public GameBoardXF(IEventAggregator aggregator) { aggregator.Subscribe(this); _thisGrid = new Grid(); Content = _thisGrid; _newOne = new MahJongSolitaireTilesXF(); _newOne.IsVisible = false; _newOne.BindingContext = null; _thisGrid.Children.Add(_newOne); }
public void Handle(MahJongSolitaireMainGameClass message) { IsVisible = true; if (_command == null) { var mod = (MahJongSolitaireMainViewModel)BindingContext; //hopefully that works. Type type = mod.GetType(); MethodInfo?method = type.GetMethod(nameof(MahJongSolitaireMainViewModel.SelectTileAsync)); if (method == null) { throw new BasicBlankException("The select tile was not found. Rethink"); } MethodInfo?fun = type.GetMethod(nameof(MahJongSolitaireMainViewModel.CanSelectTile)); if (fun == null) { throw new BasicBlankException("The canselect tile was not found. Rethink"); } _command = new PlainCommand(mod, method, fun, mod.CommandContainer); } var tempList = message.GameBoard1 !.GetPriorityBoards(); bool isNew; if (_thisGrid.Children.Count > 1) { isNew = false; } else { isNew = true; } tempList.ForEach(thisBoard => { thisBoard.TileList.ForEach(thisCard => { if (isNew == true) { MahJongSolitaireTilesXF graphicsCard = new MahJongSolitaireTilesXF(); graphicsCard.SendSize("", thisCard); graphicsCard.Command = _command; //try this way. hopefully that works. graphicsCard.CommandParameter = thisCard; // i think _thisGrid.Children.Add(graphicsCard); } else { var newItem = GetControl(thisCard); newItem !.BindingContext = null; newItem.BindingContext = thisCard; newItem.CommandParameter = thisCard; // i think } }); }); }