/// <summary> /// Handles the MouseEnter event of the Button control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param> private void Button_MouseEnter(object sender, MouseEventArgs e) { Button button = (Button)e.Source; BattleFieldAreaViewModel battleFieldAreaViewModel = (BattleFieldAreaViewModel)this.DataContext; if (battleFieldAreaViewModel.HighlightSquaresCommand != null) { battleFieldAreaViewModel.HighlightSquaresCommand.Execute(button.CommandParameter); } }
/// <summary> /// Initializes a new instance of the <see cref="SendMoveCommand"/> class. /// </summary> /// <param name="client">The client.</param> /// <param name="battleFieldAreaViewModel">The battle field area view model.</param> /// <exception cref="ArgumentNullException"> /// Is thrown if either of the value is null: /// client - The value must not be null. /// or /// battleFieldAreaViewModel - The value must not be null. /// </exception> public SendMoveCommand(Client client, BattleFieldAreaViewModel battleFieldAreaViewModel) { this.client = client ?? throw new ArgumentNullException(nameof(client), "The value must not be null."); this.battleFieldAreaViewModel = battleFieldAreaViewModel ?? throw new ArgumentNullException(nameof(battleFieldAreaViewModel), "The value must not be null."); }
/// <summary> /// Initializes a new instance of the <see cref="RandomPositionsCommand"/> class. /// </summary> /// <param name="battleFieldAreaViewModel">The battle field area view model.</param> /// <param name="battleFieldViewModel">The battle field view model.</param> /// <param name="client">The client.</param> public RandomPositionsCommand(BattleFieldAreaViewModel battleFieldAreaViewModel, BattleFieldViewModel battleFieldViewModel, Client client) { this.battleFieldAreaViewModel = battleFieldAreaViewModel; this.battleFieldViewModel = battleFieldViewModel; this.addShipPositionCommand = new AddShipPositionCommand(this.battleFieldViewModel, this.battleFieldAreaViewModel, client); }
/// <summary> /// Initializes a new instance of the <see cref="HighlightSquaresCommand"/> class. /// </summary> /// <param name="battleFieldAreaViewModel">The battle field area view model.</param> /// <param name="battleFieldViewModel">The battle field view model.</param> public HighlightSquaresCommand(BattleFieldAreaViewModel battleFieldAreaViewModel, BattleFieldViewModel battleFieldViewModel) { this.battleFieldAreaViewModel = battleFieldAreaViewModel; this.battleFieldViewModel = battleFieldViewModel; }
/// <summary> /// Initializes a new instance of the <see cref="AddShipPositionCommand"/> class. /// </summary> /// <param name="battleFieldViewModel">The battle field view model.</param> /// <param name="battleFieldArea">The battle field area view model.</param> /// <param name="client">The client.</param> public AddShipPositionCommand(BattleFieldViewModel battleFieldViewModel, BattleFieldAreaViewModel battleFieldArea, Client client) { this.battleFieldViewModel = battleFieldViewModel; this.battleFieldArea = battleFieldArea; this.client = client; }