private void RemoveShip(ShipViewModel forDelete) { leftMap.ForEach(p => { if (p.Boat == forDelete.Boat) { p.Boat = null; } }); model.Delete(forDelete.Boat); }
private void ConvertModel(Boat boat) { var res = ConvertCoordinate(boat.Cord); for (var i = 0; i < boat.Body.Length; ++i) { if (boat.Direction == Direction.Horizontal) { leftMap[res + i].Boat = boat; leftMap[res + i].IndexOfPart = i; leftMap[res + i].Part = ShipViewModel.IndetifyShipPart(i, boat.Direction, boat.type); leftMap[res + i].Refresh(); } else { leftMap[res + (i * 10)].Boat = boat; leftMap[res + (i * 10)].IndexOfPart = i; leftMap[res + (i * 10)].Part = ShipViewModel.IndetifyShipPart(i, boat.Direction, boat.type); leftMap[res + (i * 10)].Refresh(); } } }