private bool SaveChangesToInventory() { float?priceCoeficient = MyValueFormatter.GetFloatFromString(m_priceCoeficientTextbox.Text, 2, string.Empty); if (priceCoeficient == null) { MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.MessageYouMustSetPriceCoeficient, MyTextsWrapperEnum.Error, MyTextsWrapperEnum.Ok, null)); return(false); } if (priceCoeficient < 1f) { MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.MessagePriceCoeficientMustBeGreaterThanOrEqualToOne, MyTextsWrapperEnum.Error, MyTextsWrapperEnum.Ok, null)); return(false); } MyMwcInventoryTemplateTypeEnum?templateType = SelectedTemplateType; int?refillTime = RefillTime; if (refillTime != null && templateType == null || refillTime == null && templateType != null) { MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.MessageYouMustSetTemplateIfYouWantRefillInventory, MyTextsWrapperEnum.Error, MyTextsWrapperEnum.Ok, null)); return(false); } EntityWithInventory.Inventory.PriceCoeficient = priceCoeficient.Value; EntityWithInventory.Inventory.ClearInventoryItems(false); foreach (int itemKey in m_entityInventoryListbox.GetItemsKeys()) { EntityWithInventory.Inventory.AddInventoryItem(m_inventoryItemsRepository.GetItem(itemKey)); //m_inventoryItemsRepository.RemoveItem(itemKey, false); } EntityWithInventory.Inventory.TemplateType = templateType; if (PrefabContainer != null) { PrefabContainer.RefillTime = refillTime; } return(true); }