private void Init() 
        {
            m_windowIsMovable = false;
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.45f, 0.875f);
            AddCaption(new Vector2(0, -0.005f));

            AddActivatedCheckbox(GetControlsOriginLeftFromScreenSize() + new Vector2(0.05f, 0.01f), PrefabSecurityControlHUB.Activated);
            m_activatedCheckbox.OnCheck = OnActivateClick;

            m_connectedPrefabIdsListbox = new MyGuiControlListbox(this, new Vector2(0, -0.02f), new Vector2(0.2f, 0.07f), MyGuiConstants.LISTBOX_BACKGROUND_COLOR,
                MyTextsWrapper.Get(MyTextsWrapperEnum.ConnectedPrefabIds), MyGuiConstants.LABEL_TEXT_SCALE, 1, 7, 1, false, true, false);
            foreach (IMyUseableEntity connectedEntity in PrefabSecurityControlHUB.ConnectedEntities) 
            {
                MyEntity entity = connectedEntity as MyEntity;
                Debug.Assert(entity.EntityId != null);
                uint entityId = entity.EntityId.Value.NumericValue;
                m_connectedPrefabIdsListbox.AddItem((int)entityId, new StringBuilder(entityId.ToString()));
            }

            Controls.Add(m_connectedPrefabIdsListbox);

            Vector2 buttonPosition = m_connectedPrefabIdsListbox.GetPosition() + 
                new Vector2(-m_connectedPrefabIdsListbox.GetSize().Value.X / 2f, m_connectedPrefabIdsListbox.GetSize().Value.Y / 2f) + 
                new Vector2(-0.05f, 0.09f);
            Controls.Add(new MyGuiControlButton(this, buttonPosition, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Add, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnAddClick,
                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));
            buttonPosition += new Vector2(0.18f, 0f);
            Controls.Add(new MyGuiControlButton(this, buttonPosition, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Delete, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnDeleteClick,
                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true));            
        }
        public void InitControls()
        {           
            StringBuilder otherSideInventoryName = new StringBuilder();
            otherSideInventoryName.Append(string.IsNullOrEmpty(m_entity.DisplayName) ? m_entity.GetFriendlyName() : m_entity.DisplayName);
            otherSideInventoryName.Append(MyTextsWrapper.Get(MyTextsWrapperEnum.OtherSideInventory));

            Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 4f + 0.03f, 0.1f);
            Vector2 controlsOriginRight = new Vector2(+m_size.Value.X / 4f - 0.03f, 0.1f);
            List<MyGuiControlListbox> listboxesToDragAndDrop = new List<MyGuiControlListbox>();

            m_allItemsInventoryListbox = new MyGuiControlListbox(this, controlsOriginLeft, MyGuiConstants.LISTBOX_SMALL_SIZE, MyGuiConstants.LISTBOX_BACKGROUND_COLOR,
                null, MyGuiConstants.LABEL_TEXT_SCALE, COLUMNS, ROWS, COLUMNS, true, true, false, null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 4, 2, MyGuiConstants.LISTBOX_ITEM_COLOR, 0f, 0f, 0f, 0f, 0, 0, -0.01f, -0.01f, -0.02f, 0.02f);
            AddInventoryListbox(m_allItemsInventoryListbox, m_allItemsInventory, ref listboxesToDragAndDrop);

            m_entityInventoryListbox = new MyGuiControlListbox(this, controlsOriginRight, MyGuiConstants.LISTBOX_SMALL_SIZE, MyGuiConstants.LISTBOX_BACKGROUND_COLOR,
                null, MyGuiConstants.LABEL_TEXT_SCALE, COLUMNS, ROWS, COLUMNS, true, true, false, null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 4, 2, MyGuiConstants.LISTBOX_ITEM_COLOR, 0f, 0f, 0f, 0f, 0, 0, -0.01f, -0.01f, -0.02f, 0.02f);
            AddInventoryListbox(m_entityInventoryListbox, EntityWithInventory.Inventory, ref listboxesToDragAndDrop);

            m_dragAndDrop = new MyGuiControlListboxDragAndDrop(this, listboxesToDragAndDrop, MyGuiControlPreDefinedSize.SMALL, MyGuiConstants.LISTBOX_BACKGROUND_COLOR,
                MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, Vector2.Zero, true);
            m_dragAndDrop.ListboxItemDropped += DragAndDropListboxItemDropped;
            Controls.Add(m_dragAndDrop);

            Vector2 labelOffset = new Vector2(0.05f, -0.05f);            

            Controls.Add(new MyGuiControlLabel(this, m_allItemsInventoryListbox.GetPosition() - m_allItemsInventoryListbox.GetSize().Value / 2f + labelOffset,
                null, MyTextsWrapperEnum.AllItemsInventory, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(new MyGuiControlLabel(this, m_entityInventoryListbox.GetPosition() - m_entityInventoryListbox.GetSize().Value / 2f + labelOffset,
                null, otherSideInventoryName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));


            Vector2 otherSettingsPosition = new Vector2(-m_size.Value.X / 2f + 0.1f, -0.35f);
                                        
            Controls.Add(new MyGuiControlLabel(this, otherSettingsPosition,
                null, MyTextsWrapperEnum.PriceCoeficient, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_priceCoeficientTextbox = new MyGuiControlTextbox(this, otherSettingsPosition + new Vector2(0.5f, 0f), MyGuiControlPreDefinedSize.MEDIUM, string.Empty, 3, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY);
            m_priceCoeficientTextbox.Text = MyValueFormatter.GetFormatedFloat(EntityWithInventory.Inventory.PriceCoeficient, 2, string.Empty);
            Controls.Add(m_priceCoeficientTextbox);

            if (PrefabContainer != null) 
            {
                otherSettingsPosition += MyGuiConstants.CONTROLS_DELTA;

                Controls.Add(new MyGuiControlLabel(this, otherSettingsPosition,
                    null, MyTextsWrapperEnum.InventoryTemplates, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                m_inventoryTemplatesCombobox = new MyGuiControlCombobox(this, otherSettingsPosition + new Vector2(0.5f, 0f), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
                m_inventoryTemplatesCombobox.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_inventoryTemplatesCombobox_OnSelect);
                m_inventoryTemplatesCombobox.AddItem(0, MyTextsWrapperEnum.None);
                foreach (MyMwcInventoryTemplateTypeEnum inventoryTemplateType in MyGuiInventoryTemplateTypeHelpers.MyInventoryTemplateTypeValues)
                {
                    if (MyInventoryTemplates.ContainsAnyItems(inventoryTemplateType))
                    {
                        m_inventoryTemplatesCombobox.AddItem((int)inventoryTemplateType, MyGuiInventoryTemplateTypeHelpers.GetInventoryTemplateTypeHelper(inventoryTemplateType).Description);
                    }
                }
                Controls.Add(m_inventoryTemplatesCombobox);

                otherSettingsPosition += MyGuiConstants.CONTROLS_DELTA;

                Controls.Add(new MyGuiControlLabel(this, otherSettingsPosition,
                null, MyTextsWrapperEnum.RefillTime, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                m_refillTimeTextbox = new MyGuiControlTextbox(this, otherSettingsPosition + new Vector2(0.5f, 0f), MyGuiControlPreDefinedSize.MEDIUM, string.Empty, 9, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY);                
                Controls.Add(m_refillTimeTextbox);

                RefillTime = PrefabContainer.RefillTime;
                SelectedTemplateType = EntityWithInventory.Inventory.TemplateType;
            }            
        }