private void OnEditClick(MyGuiControlButton sender)
        {
            var selected = m_selectShipsListbox.GetSelectedItem();

            if (selected != null)
            {
                BotTemplate template      = m_bots[selected.Key];
                int?        selectedIndex = null;
                var         builders      = GetTemplatesForCombobox(template.m_builder, out selectedIndex);
                Debug.Assert(selectedIndex != null, "This shouldn't happen!");
                if (selectedIndex == null)
                {
                    selectedIndex = 0;
                }
                MyGuiScreenEditorSmallShip screen = new MyGuiScreenEditorSmallShip(template.m_builder, builders, selectedIndex.Value);
                screen.OnOk += delegate
                {
                    if (template.m_builder.ShipTemplateID != null)
                    {
                        OnEditBot(template.m_builder, MySmallShipTemplates.GetTemplate(template.m_builder.ShipTemplateID.Value));
                    }
                    else
                    {
                        OnEditBot(template.m_builder);
                    }
                };

                MyGuiManager.AddScreen(screen);
            }
        }
        private void OnEditClick(MyGuiControlButton sender)
        {
            var selected = m_selectShipsListbox.GetSelectedItem();
            if (selected != null)
            {
                BotTemplate template = m_bots[selected.Key];
                int? selectedIndex = null;
                var builders = GetTemplatesForCombobox(template.m_builder, out selectedIndex);
                Debug.Assert(selectedIndex != null, "This shouldn't happen!");
                if (selectedIndex == null) 
                {
                    selectedIndex = 0;
                }
                MyGuiScreenEditorSmallShip screen = new MyGuiScreenEditorSmallShip(template.m_builder, builders, selectedIndex.Value);
                screen.OnOk += delegate 
                {
                    if (template.m_builder.ShipTemplateID != null)
                    {
                        OnEditBot(template.m_builder, MySmallShipTemplates.GetTemplate(template.m_builder.ShipTemplateID.Value));
                    }
                    else
                    {
                        OnEditBot(template.m_builder);
                    }
                };

                MyGuiManager.AddScreen(screen);
            }
        }