Пример #1
0
 private void UserForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!(ShipChanged?.Invoke(new Ship()) ?? false))
     {
         e.Cancel = true;
     }
 }
 protected void OnShipChanged(Ship shipUpdated, bool killed)
 {
     ShipChanged?.Invoke(this, new ShipChangedEventArgs(shipUpdated, killed));
 }
Пример #3
0
 private void btnBoat_Click(object sender, EventArgs e) =>
 ShipChanged?.Invoke(new Ship(ShipType.Boat, ShipOrientation.Vertical & ShipOrientation.Horizontal));
Пример #4
0
 private void btnDestroyerVertical_Click(object sender, EventArgs e) =>
 ShipChanged?.Invoke(new Ship(ShipType.Destroyer, ShipOrientation.Vertical));
Пример #5
0
 private void btnCruiserHorizontal_Click(object sender, EventArgs e) =>
 ShipChanged?.Invoke(new Ship(ShipType.Cruiser, ShipOrientation.Horizontal));
Пример #6
0
 private void btnBattleshipVertical_Click(object sender, EventArgs e) =>
 ShipChanged?.Invoke(new Ship(ShipType.Battleship, ShipOrientation.Vertical));