コード例 #1
0
        public async Task Refresh()
        {
            _receiptItems.Clear();
            _goodsItems.Clear();

            List <AlbumItem> receipts = await _azure.GetAllImages(CurrentTransaction.ID, true);

            foreach (AlbumItem t in receipts)
            {
                Receipts.Add(t);
            }

            receipts.Add(new AlbumItem {
                IsAddButton = true, IsReceipt = true
            });
            int            i       = 0;
            ImageListItems tempILI = new ImageListItems();

            foreach (AlbumItem t in receipts)
            {
                //RESET temp class for next ListEntry
                if (tempILI == null)
                {
                    tempILI = new ImageListItems();
                }

                //Add Image
                tempILI.ItemImages.Add(t);

                //Add ListEntry content and reset for next Entry
                if (i >= 3)
                {
                    ReceiptItems.Add(tempILI);
                    tempILI = null;
                    i       = 0;
                }
                i++;
            }

            //Fill aditional spaces with filler image
            if (tempILI != null)
            {
                for (int j = tempILI.ItemImages.Count; j < 3; j++)
                {
                    tempILI.ItemImages.Add(new AlbumItem());
                }
                ReceiptItems.Add(tempILI);
            }

            //Reset Values to refresh Goods
            tempILI = null;
            i       = 0;


            List <AlbumItem> goods = await _azure.GetAllImages(CurrentTransaction.ID, false);

            foreach (AlbumItem t in goods)
            {
                Goods.Add(t);
            }

            goods.Add(new AlbumItem {
                IsAddButton = true, IsReceipt = false
            });
            foreach (AlbumItem t in goods)
            {
                if (tempILI == null)
                {
                    tempILI = new ImageListItems();
                }

                tempILI.ItemImages.Add(t);
                if (i >= 3)
                {
                    GoodsItems.Add(tempILI);
                    tempILI = null;
                    i       = 0;
                }
                i++;
            }

            //Fill aditional spaces with filler image
            if (tempILI != null)
            {
                for (int j = tempILI.ItemImages.Count; j < 3; j++)
                {
                    tempILI.ItemImages.Add(new AlbumItem());
                }
                GoodsItems.Add(tempILI);
            }
            HockeyApp.MetricsManager.TrackEvent("Images Page Loaded");
        }
コード例 #2
0
        public async Task Refresh()
        {
            // NEED TO REWORK FOR THE NEW VIEW - OUTDATED

            IsLoading = true;

            #region Receipts
            Receipts.Clear();
            List <AlbumItem> receipts = await _azure.GetAllImages(CurrentTransaction.ID, true);

            foreach (AlbumItem t in receipts)
            {
                Receipts.Add(t);
            }

            receipts.Add(new AlbumItem {
                IsAddButton = true, IsReceipt = true
            });
            int            i       = 0;
            ImageListItems tempILI = new ImageListItems();

            //ClearItems before applying new items
            ReceiptItems.Clear();
            foreach (AlbumItem t in receipts)
            {
                //RESET temp class for next ListEntry
                if (tempILI == null)
                {
                    tempILI = new ImageListItems();
                }

                //Add Image
                tempILI.ItemImages.Add(t);

                //Add ListEntry content and reset for next Entry
                if (i >= 3)
                {
                    ReceiptItems.Add(tempILI);
                    tempILI = null;
                    i       = 0;
                }
                i++;
            }

            //Fill aditional spaces with filler image
            if (tempILI != null)
            {
                for (int j = tempILI.ItemImages.Count; j < 3; j++)
                {
                    tempILI.ItemImages.Add(new AlbumItem());
                }
                ReceiptItems.Add(tempILI);
            }
            #endregion

            //Reset Values to refresh Goods
            tempILI = null;
            i       = 0;

            #region Goods
            Goods.Clear();
            List <AlbumItem> goods = await _azure.GetAllImages(CurrentTransaction.ID, false);

            foreach (AlbumItem t in goods)
            {
                Goods.Add(t);
            }

            goods.Add(new AlbumItem {
                IsAddButton = true, IsReceipt = false
            });
            //ClearItems before applying new items
            GoodsItems.Clear();
            foreach (AlbumItem t in goods)
            {
                if (tempILI == null)
                {
                    tempILI = new ImageListItems();
                }

                tempILI.ItemImages.Add(t);
                if (i >= 3)
                {
                    GoodsItems.Add(tempILI);
                    tempILI = null;
                    i       = 0;
                }
                i++;
            }

            //Fill aditional spaces with filler image
            if (tempILI != null)
            {
                for (int j = tempILI.ItemImages.Count; j < 3; j++)
                {
                    tempILI.ItemImages.Add(new AlbumItem());
                }
                GoodsItems.Add(tempILI);
            }
            #endregion

            List <AlbumItem> images = await _azure.GetAllImages(CurrentTransaction.ID);

            foreach (AlbumItem image in images)
            {
                Images.Add(image);
            }

            if (!IsUnitTesting)
            {
                HockeyApp.MetricsManager.TrackEvent("Images Page Loaded");
            }

            IsLoading = false;
        }