Beispiel #1
0
 public void Handle(TileChosenEventModel message)
 {
     if (message.Deck > 0)
     {
         MahjongSolitaireTileInfo thisTile = new MahjongSolitaireTileInfo();
         thisTile.Populate(message.Deck);
         thisTile.Top     = 715;
         thisTile.Left    = 1000;
         thisTile.Visible = false; //for now, unable to show what you selected.  if i need this for tablet, rethink.
         if (_newOne.BindingContext == null)
         {
             _newOne.SendSize("", thisTile);
         }
         else
         {
             _newOne.BindingContext = null;
             _newOne.BindingContext = thisTile; // to refresh just in case.
         }
         _newOne.IsVisible = true;
         _newOne.IsVisible = false; //because does not work right for positioning.
     }
     else
     {
         _newOne.IsVisible = false;
     }
 }
        //not sure if we needed the undo event now.


        //public void Handle(UndoEventModel message)
        //{
        //    foreach (var firstBoard in _thisMod.MainGame!.SaveRoot!.BoardList)
        //    {
        //        foreach (var firstCard in firstBoard.TileList)
        //            GetControl(firstCard);// hopefully this simple.
        //    }
        //    var thisList = message.PreviousList;
        //    CustomBasicList<MahJongSolitaireTilesWPF> nextList = new CustomBasicList<MahJongSolitaireTilesWPF>();
        //    MahJongSolitaireTilesWPF graphicsCard;
        //    foreach (var thisCard in thisList!)
        //    {
        //        var newItem = GetControl(thisCard);
        //        if (newItem != null)
        //        {
        //            _thisGrid.Children.Remove(newItem);
        //        }
        //        graphicsCard = new MahJongSolitaireTilesWPF();
        //        graphicsCard.SendSize("", thisCard);
        //        graphicsCard.Margin = new Thickness(0, 0, 0, 0);
        //        Binding ThisBind = new Binding(nameof(MahJongSolitaireViewModel.TileSelectedCommand));
        //        ThisBind.Source = _thisMod;
        //        graphicsCard.SetBinding(MahJongSolitaireTilesWPF.CommandProperty, ThisBind);
        //        graphicsCard.CommandParameter = thisCard; // i think
        //        nextList.Add(graphicsCard);
        //    }
        //    if (nextList.Count == 0)
        //        return;// there was no new items
        //    foreach (var ThisGR in nextList)
        //        _thisGrid.Children.Add(ThisGR);
        //    return;
        //}
        //public void Handle(StartNewGameEventModel message)
        //{
        //    _thisGrid.Children.Clear();
        //    _newOne.Visibility = Visibility.Collapsed;
        //    _thisGrid.Children.Add(_newOne);
        //}
        public void Handle(TileChosenEventModel message)
        {
            if (message.Deck > 0)
            {
                MahjongSolitaireTileInfo thisTile = new MahjongSolitaireTileInfo();
                thisTile.Populate(message.Deck);
                thisTile.Top  = 715;
                thisTile.Left = 1000;
                if (_newOne.DataContext == null)
                {
                    _newOne.SendSize("", thisTile);
                }
                else
                {
                    _newOne.DataContext = null;
                    _newOne.DataContext = thisTile; // to refresh just in case.
                }
                _newOne.Visibility = Visibility.Visible;
            }
            else
            {
                _newOne.Visibility = Visibility.Collapsed;
            }
        }