コード例 #1
0
 private void UserForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!(ShipChanged?.Invoke(new Ship()) ?? false))
     {
         e.Cancel = true;
     }
 }
コード例 #2
0
 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));