Exemple #1
0
        protected override void OnRequestItem(int index, ItemRequestCallback callback)
        {
            string wtv = "";

            if (this.Items.ContainsKey(index))
            {
                wtv = this.Items[index];
            }
            callback(this, index, wtv);
        }
 private void GetItem(VirtualList vlist, int idx, ItemRequestCallback callbackItem)
 {
     object commandForItem = null;
     if (((VirtualList)this.m_listContent).IsItemAvailable(idx))
     {
         commandForItem = this.m_listContent[idx];
     }
     else if (((this.titles != null) && (idx >= 0)) && (idx < this.titles.Count))
     {
         OMLEngine.Title item = this.titles[idx] as OMLEngine.Title;
         if (item != null)
         {
             commandForItem = this.GetCommandForItem(item);
         }
     }
     callbackItem(vlist, idx, commandForItem);
 }
Exemple #3
0
        private void GetItem(VirtualList vlist, int idx, ItemRequestCallback callbackItem)
        {
            object commandForItem = null;

            if (((VirtualList)this.m_listContent).IsItemAvailable(idx))
            {
                commandForItem = this.m_listContent[idx];
            }
            else if (((this.titles != null) && (idx >= 0)) && (idx < this.titles.Count))
            {
                OMLEngine.Title item = this.titles[idx] as OMLEngine.Title;
                if (item != null)
                {
                    commandForItem = this.GetCommandForItem(item);
                }
            }
            callbackItem(vlist, idx, commandForItem);
        }
Exemple #4
0
        private void GetItem(VirtualList vlist, int idx, ItemRequestCallback callbackItem)
        {
            object commandForItem = null;

            if (((VirtualList)this.m_listContent).IsItemAvailable(idx))
            {
                commandForItem = this.m_listContent[idx];
            }
            else if (((this.m_filters != null) && (idx >= 0)) && (idx < this.m_filters.Count))
            {
                UserFilter item = this.m_filters[idx] as UserFilter;
                if (item != null)
                {
                    commandForItem = this.GetCommandForItem(item);
                }
            }
            callbackItem(vlist, idx, commandForItem);
        }
Exemple #5
0
        //
        // Item Request
        //
        // The repeater is ready to build visuals for the data at the specified
        // index. An index is queried if the visual representation of that item
        // is ready to be displayed. You are given a delegate to call back on
        // to report the data item.
        //
        // NOTE: Never block within this call and always call the callback delegate
        //       on this (the application) thread!
        //
        // Depending on your data situation, you may choose to:
        //
        // 1) Call the callback immediately (recommended):
        //
        // If you call the callback immediately, your are providing the required
        // data item right now. However, you don't have to guarantee that the
        // data item is complete (in which case, you can fill in with "placeholder"
        // data). The benefit of an immediate return (even if it's partial data) is
        // that there will always be something on the screen for the user to see and
        // interact with.
        //
        // In general, you should build a data item and populate it with only
        // data that can be queried quickly. Any data that is too slow to get
        // during this call should be provided in the "update" callback.
        //
        // 2) Call callback at a later time:
        //
        // If you call the callback later, the negative is that the user will
        // see a "hole" in the list while you fetch the data on a worker thread.
        // Although this is supported, it's not recommended. Make sure to always
        // call the callback back on the main application thread.
        //

        protected override void OnRequestItem(int index, ItemRequestCallback callback)
        {
            //
            // Build the data item and initialize it with data that
            // is quick to get (in this case, the caption).
            //
            // Notice how the VirtualList is passed to the ThumbnailData. This is
            // so every ModelItem created (in this case, the ThumbnailData) gets
            // assigned an owner. This is important since when the VirtualList gets
            // disposed, the ThumbnailData will also get disposed automatically.
            //

            ThumbnailData t = new ThumbnailData(this, index.ToString(CultureInfo.CurrentUICulture));


            //
            // Inform the list.
            //

            callback(this, index, t);
        }
        /// <summary>
        /// Create a new video item and pass it the relevant info to get the data
        /// </summary>
        /// <param name="index">the index of the item being requested</param>
        /// <param name="callback"></param>
        protected override void OnRequestItem(int index, ItemRequestCallback callback)
        {
            //if there is no query, then this is pointless anyway
            if (Query == "")
            {
                return;
            }

            //since we are batching up requests, see if this batch has already been requested.
            //If it hasn't been requested, we need to request the data.

            //if we can't find this item in the retrieved items list,
            if (!_retrievedItem.ContainsKey(index))
            {
                //figure out the correct batch request and make it
                int startIndex = (int)Math.Floor((decimal)(index / batchSize)) * batchSize;
                GetVideoData(Query, startIndex, batchSize);
            }

            //in theory, we cannot be here without having got data first
            //so if the
            if (_retrievedItem.ContainsKey(index))
            {
                //create a new video item
                VideoItem v = new VideoItem(this, index);

                //get the data from the retrieval and parse
                v.processNodeData((JObject)_retrievedItem[index]);

                //now free up the memory by removing the retrieved info
                _retrievedItem.Remove(index);

                //now let the list know
                callback(this, index, v);
            }
        }
Exemple #7
0
        protected override void OnRequestItem(int index, ItemRequestCallback callback)
        {
            MovieItem t = (MovieItem)this.internalArray[index];//ThumbnailData(this, index.ToString(CultureInfo.CurrentUICulture));

            callback(this, index, t);
        }
 private void GetItem(VirtualList vlist, int idx, ItemRequestCallback callbackItem)
 {
     object commandForItem = null;
     if (((VirtualList)this.m_listContent).IsItemAvailable(idx))
     {
         commandForItem = this.m_listContent[idx];
     }
     else if (((this.m_filters != null) && (idx >= 0)) && (idx < this.m_filters.Count))
     {
         UserFilter item = this.m_filters[idx] as UserFilter;
         if (item != null)
         {
             commandForItem = this.GetCommandForItem(item);
         }
     }
     callbackItem(vlist, idx, commandForItem);
 }