/// <summary> /// Constructor for <see cref="GameViewModel"/>. /// </summary> public GameViewModel( IGameServiceProvider gameServiceProvider, IEndpointInfo endpointInfo, IUserMessage userMessage, IPieceMasterFactory masterFactory, LocalNavigator navigator) { _masterFactory = masterFactory; _navigator = navigator; _gameServiceProvider = gameServiceProvider; _endpointInfo = endpointInfo; _userMessage = userMessage; var chessDefaultField = VirtualFieldUtils.CreateDefaultField(); _gameField = new VirtualField(chessDefaultField); _controller = new GameController(); _controller.Movement += OnChessPieceMovement; PlayMoreCommand = new DelegateCommand(PlayMoreHandler); DisconnectCommand = new DelegateCommand(DisconnectHandler); }
/// <summary> /// Constructor for <see cref="ConnectionViewModel"/>. /// </summary> public ConnectionViewModel( IWcfClientFactory <IUserService> userService, IWcfClientFactory <IChessService> chessService, ChessServiceCallback serviceCallback, WaitViewModel.Factory waitFactory, LocalNavigator navigator, IMainWindow mainWindow) { _chessService = chessService; _userService = userService; _serviceCallback = serviceCallback; _navigator = navigator; _mainWindow = mainWindow; _waitOpponent = waitFactory("Awaiting new opponent...", "Disconnecting...", true, CancelCallback); _waitViewModel = _waitConnect = waitFactory("Connecting to server..."); _serverAddress = "localhost"; _playerName = NameGenerator.GetNext(); ConnectCommand = new DelegateCommand(OnConnect); _serviceCallback.GameStarted -= OnGameStarted; _serviceCallback.GameStarted += OnGameStarted; }