Exemple #1
0
        private async void UpdateShelf(string name, ItemLayout itemLayout, int cellIndex)
        {
            // Update copies: Meta Item Base contains copies of items that should be updated
            ItemLayout metaItemLayout     = ContentManager.MetaItemBase[itemLayout.ItemData.ID];
            ItemLayout unplacedItemLayout = ContentManager.UnplacedItemBase[itemLayout.ItemData.ID];

            itemLayout.iconImage.RemoveEffect(typeof(ScreenTouch));
            itemLayout.IsVisible = false;


            metaItemLayout.ItemData.SetStorage(name, cellIndex, ContentManager.GetStorageType());
            itemLayout.ItemData.SetStorage(name, cellIndex, ContentManager.GetStorageType());

            ContentManager.UnplacedItemBase.Remove(itemLayout.ItemData.ID);
            GridManager.RemoveGridItem(ContentManager.unplacedGridName, unplacedItemLayout);

            // Weird fact: the animation actually allows the touchEffect cycle to complete without complaining that the item is disposed.
            var storage        = ContentManager.GetSelectedStorage(name);
            var cellBackground = storage.GetGridCell(cellIndex).GetBackground();
            await ViewExtensions.QuadraticInterpolator(cellBackground, 0.2, 250, d => cellBackground.Scale = d + 1, null);

            GridManager.RemoveGridItem(partialUnplacedGrid, itemLayout);

            storage.AddGridItems(cellIndex, new List <View>()
            {
                itemLayout
            });

            if (ContentManager.isLocal)
            {
                LocalStorageController.UpdateItem(itemLayout.ItemData);
            }
            else
            {
                FireBaseController.SaveItem(itemLayout.ItemData);
            }
        }