private void btnConfirmtarget_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         String yString = this.CoordinatesTarget.Substring(1);
         try
         {
             int      y      = Int32.Parse(yString);
             Position target = new Position(this.CoordinatesTarget[0], y);
             PlayerViewControl.TargetFire(target, this.Computer);
             this.ShipNumber(this.Computer, target, false);
             System.Console.WriteLine("PC count :" + this.Computer.Ships.Count);
             if (this.Computer.Ships.Count != 0)
             {
                 target = ComputerViewControl.IATargetFire(this.Player);
                 this.ShipNumber(this.Player, target, true);
                 GeneratePlayerMap(this.Player.PlayerMap);
                 GenerateComputerMap(this.Computer.PlayerMap);
                 System.Console.WriteLine("human count :" + this.Player.Ships.Count);
             }
         }
         catch (Exception)
         {
             System.Windows.MessageBox.Show("Vos ingénieurs vont avoir du mal à savoir où viser si vous ne donnez qu'une seule coordonée.");
         }
     }
     catch (Exception)
     {
         System.Windows.MessageBox.Show("Veuillez entrer une cible valide. Les ingénieurs qui organisent le tir n'ont rien compris à votre demande.");
     }
 }
        private void BtnConfirmShipPlacement_Click(object sender, RoutedEventArgs e)
        {
            Map      playerMap   = this.PlayerMap;
            Map      computerMap = this.ComputerMap;
            Player   player      = new Player(playerMap, this.Ships);
            Computer computer    = new Computer(Difficulty.easy, computerMap, this.Ships);

            ComputerViewControl.ShipPlacement(computer);
            System.Console.WriteLine(computer.PlayerMap.ToString());
            bool shipPlacement = false;

            foreach (var ship in Ships)
            {
                if (ship.ShipType == ShipType.Carrier)
                {
                    if (PlayerViewControl.ShipPlacement(ship, CarrierX, CarrierY, player, CarrierDirection))
                    {
                        shipPlacement = true;
                    }
                    else
                    {
                        shipPlacement = false;
                        break;
                    }
                }
                if (ship.ShipType == ShipType.Battleship)
                {
                    if (PlayerViewControl.ShipPlacement(ship, BattleShipX, BattleShipY, player, BattleShipDirection))
                    {
                        shipPlacement = true;
                    }
                    else
                    {
                        shipPlacement = false;
                        break;
                    }
                }
                if (ship.ShipType == ShipType.Submarine)
                {
                    if (PlayerViewControl.ShipPlacement(ship, SubmarineX, SubmarineY, player, SubmarineDirection))
                    {
                        shipPlacement = true;
                    }
                    else
                    {
                        shipPlacement = false;
                        break;
                    }
                }
                if (ship.ShipType == ShipType.Destroyer)
                {
                    if (PlayerViewControl.ShipPlacement(ship, DestroyerX, DestroyerY, player, DestroyerDirection))
                    {
                        shipPlacement = true;
                    }
                    else
                    {
                        shipPlacement = false;
                        break;
                    }
                }
            }

            if (shipPlacement)
            {
                using (var db = new ApplicationDbContext())
                {
                    db.MapDbSet.Add(this.PlayerMap);
                    db.MapDbSet.Add(this.ComputerMap);
                    db.SaveChanges();
                }
                (this.Parent as Window).Content = new BattleShips(player, computer);
            }
            else
            {
                this.PlayerMap   = new Map(this.MapSize);
                this.ComputerMap = new Map(this.MapSize);
                System.Windows.MessageBox.Show("Revoyez le placement de vos bateaux.");
            }
        }