public SquareVM(Square square, BoardVM board) { Board = board; Square = square; Square.PieceChanged += (sender, e) => { this.RaisePropertyChanged(nameof(Piece)); }; Square.ControlledByBlackChanged += (sender, e) => { this.RaisePropertyChanged(nameof(IsControlledByBlack)); }; Square.ControlledByWhiteChanged += (sender, e) => { this.RaisePropertyChanged(nameof(IsControlledByWhite)); }; }
public BoardControl(BoardVM vm, IImagesFactory piecesImageFactory) { InitializeComponent(); Border.BorderBrush = new ImageBrush(new BitmapImage(BORDER_URI)); _piecesImageFactory = piecesImageFactory; _vm = vm; DataContext = vm; Init(); }
public BoardCellControl(SquareVM vm, IImagesFactory imagesFactory) { _vm = vm; _board = vm.Board; DataContext = vm; _imageFactory = imagesFactory; Position = vm.Position; Background = GetColorFromVM(vm.Color); BorderBrush = System.Windows.Media.Brushes.Black; SetGridCoordinate(); InitializeComponent(); vm.WhenAny(x => x.Piece, x => x.Value) .Subscribe(SetImage); }
public MainWindowVM(IBoardFactory boardFactory, IStartingPiecesSetFactory pieceFactory) { Board = new BoardVM(boardFactory.GetBoard(pieceFactory)); }