Exemplo n.º 1
0
        public void ClearAndAddHistoryItems(IEnumerable <HistoryItem.T> items)
        {
            Clear();
            foreach (HistoryItem.T item in items)
            {
                BoardMove.T move = item.Move;
                PieceTypes  pt   = PieceTypes.ptNone;
                if (move.Color.Equals(Piece.Colors.Black))
                {
                    pt = PieceTypes.ptBlack;
                }
                else if (move.Color.Equals(Piece.Colors.White))
                {
                    pt = PieceTypes.ptWhite;
                }

                MoveHistoryItem vm = new MoveHistoryItem(item.ID, pt,
                                                         Coord.toString(BoardMove.getSourceCoord(move)),
                                                         Coord.toString(BoardMove.getTargetCoord(move)),
                                                         BoardMove.getRemovedPiecesCount(move));

                Add(vm);
            }

            OnPropertyChanged("Count");
            OnCollectionChanged();
        }