private void cmdDeleteMod_Click(object sender, EventArgs e) { TreeNode objSelectedNode = treMods.SelectedNode; if (objSelectedNode == null) { return; } string strSelectedId = objSelectedNode.Tag.ToString(); if (!string.IsNullOrEmpty(strSelectedId) && strSelectedId.IsGuid()) { VehicleMod objMod = _lstMods.FirstOrDefault(x => x.InternalId == strSelectedId); if (objMod != null && !objMod.IncludedInVehicle) { if (!CommonFunctions.ConfirmDelete(LanguageManager.GetString("Message_DeleteVehicle"))) { return; } _lstMods.Remove(objMod); foreach (Weapon objLoopWeapon in objMod.Weapons) { objLoopWeapon.DeleteWeapon(); } foreach (Cyberware objLoopCyberware in objMod.Cyberware) { objLoopCyberware.DeleteCyberware(); } TreeNode objParentNode = objSelectedNode.Parent; objSelectedNode.Remove(); if (objParentNode.Nodes.Count == 0) { objParentNode.Remove(); } } } }