private void BtnFly_Click(object sender, EventArgs e) { ComboboxDialog dialog = new ComboboxDialog(cities); dialog.ShowDialog(); if (dialog.SelectedCity != null) { if (CityName.Equals(dialog.SelectedCity.Name)) { MessageBox.Show("Увы, самолёт уже там."); } else if (plane.status != "В полёте") { MessageBox.Show($"На перелет будет потрачено {game.RebasePlane(plane.ID, dialog.SelectedCity.ID)}$"); btnFly.Enabled = false; CityName = "В полёте"; plane.status = "В полёте"; } else { MessageBox.Show("Самолёт уже в полёте."); } } else { if (dialog.PressCancel) { return; } MessageBox.Show("Увы, туда самолёт послать нельзя."); } }
public bool Equals(ClockInfo other) { if (ReferenceEquals(this, other)) { return(true); } return(CityName.Equals(other.CityName) && TimeZoneId.Equals(other.TimeZoneId)); }
public override string ToString() { if (CityName.Equals("remote", StringComparison.InvariantCultureIgnoreCase)) { return("Remote"); } else { return($"{CityName}, {Province}"); } }