void TerminalSystem_BlockRemoved(MyTerminalBlock obj) { var removedAssembler = obj as MyAssembler; if (removedAssembler != null) { removedAssembler.CustomNameChanged -= assembler_CustomNameChanged; int?key = null; foreach (var entry in m_assemblersByKey) { if (entry.Value == removedAssembler) { key = entry.Key; break; } } if (key.HasValue) { m_assemblersByKey.Remove(key.Value); m_comboboxAssemblers.RemoveItem(key.Value); } if (removedAssembler == m_selectedAssembler) { if (m_assemblersByKey.Count > 0) { m_comboboxAssemblers.SelectItemByIndex(0); } else { ShowError(MySpaceTexts.ScreenTerminalError_NoAssemblers, m_controlsParent); } } } }
void onClick_DeleteCutsceneButton(MyGuiControlButton sender) { var cutscenes = MySession.Static.GetComponent <MySessionComponentCutscenes>(); if (m_selectedCutscene != null) { cutscenes.GetCutscenes().Remove(m_selectedCutscene.Name); m_comboCutscenes.RemoveItem(m_selectedCutscene.Name.GetHashCode()); if (cutscenes.GetCutscenes().Count == 0) { m_selectedCutscene = null; } else { m_comboCutscenes.SelectItemByIndex(cutscenes.GetCutscenes().Count - 1); } } }