public async Task DeleteArchitecture(object architecture) { var arch = architecture as ArchitectureModel; if (arch == null) { return; } await _architecturesManager.RemoveArchitecture(arch.Id); ArchitectureList.Remove(arch); }
private void BtDelchrhi_Click(object sender, RoutedEventArgs e) { for (int i = lbMiliKind.Items.Count - 1; i >= 0; i--) { CheckBox checkBox = lbMiliKind.Items[i] as CheckBox; if (checkBox.IsChecked == true) { GameObjects.TroopDetail.MilitaryKind militaryKind = checkBox.Content as GameObjects.TroopDetail.MilitaryKind; baseMilitaryKindstemp.RemoveMilitaryKind(militaryKind.ID); lbMiliKind.Items.Remove(lbMiliKind.Items[i]); } } for (int i = lbArchis.Items.Count - 1; i >= 0; i--) { CheckBox checkBox = lbArchis.Items[i] as CheckBox; if (checkBox.IsChecked == true) { Architecture architecture = checkBox.Content as Architecture; if (architecture.Persons.HasGameObject(leadertemp)) { MessageBox.Show("无法删除" + architecture.Name + "," + faction.Name + "的君主" + leadertemp.Name + "在此城池中"); checkBox.IsChecked = false; } else { architectureListtemp.Remove(architecture); if (capitaltemp == architecture) { capitaltemp = null; btCapital.Content = capitaltemp; } lbArchis.Items.Remove(lbArchis.Items[i]); } } } }