Beispiel #1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            ChessBoard board = new ChessBoard();
            IChessService chessService = new StaticChessService();
            ChessBoardPresentationModel model = new ChessBoardPresentationModel(board, chessService);

            this.MainWindow = model.View;
            this.MainWindow.Show();
        }
        public ChessBoardPresentationModel(ChessBoard chessboard, IChessService chessService)
        {
            this.chessService = chessService;
            this.chessService.MoveCompleted += this.ChessService_MoveCompleted;
            this.chessService.ResetCompleted += (sender, e) =>
                                                    {
                                                        if (e.Error == null)
                                                        {
                                                            this.View.DrawBoard(e.Board);
                                                        }
                                                    };

            this.View = chessboard;

            this.View.Model = this;
            this.Reset();
        }