public IParseble Parse(JSONNode purchaseNode)
 {
     if (purchaseNode.Count == 0)
     {
         return(null);
     }
     if (purchaseNode ["virtual_currency"] != null)
     {
         virtualCurrency = new VirtualCurrency().Parse(purchaseNode ["virtual_currency"]) as VirtualCurrency;
     }
     if (purchaseNode ["virtual_items"] != null)
     {
         virtualItems = new VirtualItems().Parse(purchaseNode ["virtual_items"]) as VirtualItems;
     }
     if (purchaseNode ["subscription"] != null)
     {
         subscription = new Subscription().Parse(purchaseNode ["subscription"]) as Subscription;
     }
     if (purchaseNode ["payment_system"] != null)
     {
         paymentSystem = new PaymentSystem().Parse(purchaseNode ["payment_system"]) as PaymentSystem;
     }
     if (purchaseNode ["checkout"] != null)
     {
         checkout = new Checkout().Parse(purchaseNode ["checkout"]) as Checkout;
     }
     ;
     return(this);
 }
        /// <summary>
        /// Gets the item with the given <c>itemId</c>.
        /// </summary>
        /// <param name="itemId">Item id.</param>
        /// <exception cref="VirtualItemNotFoundException">Exception is thrown if item is not found.</exception>
        /// <returns>Item with the given id.</returns>
        public static VirtualItem GetItemByItemId(string itemId)
        {
            SoomlaUtils.LogDebug(TAG, "Trying to fetch an item with itemId: " + itemId);

            VirtualItem item;

            if (VirtualItems != null && VirtualItems.TryGetValue(itemId, out item))
            {
                return(item);
            }
            throw new VirtualItemNotFoundException("itemId", itemId);
        }
 public IParseble Parse(JSONNode purchaseNode)
 {
     if (purchaseNode.Count == 0)
         return null;
     if(purchaseNode ["virtual_currency"] != null)
         virtualCurrency = new VirtualCurrency ().Parse (purchaseNode ["virtual_currency"]) as VirtualCurrency;
     if(purchaseNode ["virtual_items"] != null)
         virtualItems = new VirtualItems().Parse(purchaseNode ["virtual_items"]) as VirtualItems;
     if(purchaseNode ["subscription"] != null)
         subscription = new Subscription ().Parse (purchaseNode ["subscription"]) as Subscription;
     if(purchaseNode ["payment_system"] != null)
         paymentSystem = new PaymentSystem().Parse(purchaseNode ["payment_system"]) as PaymentSystem;
     if (purchaseNode ["checkout"] != null)
         checkout = new Checkout ().Parse(purchaseNode ["checkout"]) as Checkout;;
     return this;
 }
Example #4
0
        public void Update(IQueryable <T> items, int selectIndex)
        {
            if (selectIndex >= items.Count())
            {
                throw new Exception("Selected index must be within bounds");
            }

            VirtualItems = (Sorter != null) ? Sorter(items, SortColumn, SortDirection) : items;
            PageCount    = VirtualItems.Count() / PageSize;

            if (selectIndex != -1)
            {
                Page = selectIndex / PageSize;
            }
            else
            {
                Page = PageCount;
            }

            Display(selectIndex);
        }
Example #5
0
        private void Display()
        {
            BeginUpdate();

            Items.Clear();
            var pagedItems = VirtualItems.Skip(Page * PageSize).Take(PageSize);

            foreach (T item in pagedItems)
            {
                RetrieveItemEventArgs e = new RetrieveItemEventArgs(item);
                RetrieveItem(this, e);

                if (e.ListViewItem == null)
                {
                    throw new Exception("ListViewItem cannot be null");
                }

                Items.Add(e.ListViewItem);
            }

            AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);

            EndUpdate();
        }