Beispiel #1
0
 void listViewResults_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     if (e.ItemIndex >= 0 && e.ItemIndex < dataStream.Length)
     {
         e.Item = new ListViewItem(dataStream[e.ItemIndex]);
     }
 }
Beispiel #2
0
		private void listView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
		{
			// Check if the item is in the local cache.
			DataRow match = null;
			if (dtCachedItems != null)
				match = dtCachedItems.Rows.Find(e.ItemIndex + 1);

			if (match == null)
			{
				// The item isn't in memory.
				// Get a new range of 100 records.
				int from, to;
				if (e.ItemIndex < 50)
					from = 0;
				else
					from = (e.ItemIndex - 50);

				to = from + 100;
				dtCachedItems = NorthwindDB.GetOrders(from, to);

				// Don't use the MessageBox to show this information.
				// Hiding any part of the ListView can retrigger this event.
				lblStatus.Text = String.Format(
					"Fetched rows from {0} to {1}.",
					from.ToString(), to.ToString());

				match = dtCachedItems.Rows.Find(e.ItemIndex + 1);
			}

			// Create the ListViewItem for the matching record.
			e.Item = new ListViewItem(match["OrderID"].ToString());
			e.Item.SubItems.Add(match["ShippedDate"].ToString());
		}
Beispiel #3
0
 void OnRetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     var item=_vmd.BoneMotions[e.ItemIndex];
     e.Item = new ListViewItem(new string[]{
             item.BoneName,
             item.FrameNum.ToString()
             });
 }
Beispiel #4
0
        private void SearchResultsListViewRetrieveVItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            Contract.Requires(e.ItemIndex >= 0);
            Contract.Requires(e.ItemIndex < this._vehicleResults.Count);

            var vehicle = _vehicleResults[e.ItemIndex];
            e.Item = new ListViewItem(new[] { vehicle.Id.ToString(), VehicleInfo.GetUsedCount(vehicle).ToString()});
        }
 public void EnumerationListView_RetrieveVirtualItem(object Sender, RetrieveVirtualItemEventArgs e)
 {
     if (e.ItemIndex < 0 || e.ItemIndex >= enumeration.Count)
         return;
     IdentifiableName item = enumeration[e.ItemIndex];
     e.Item = new ListViewItem();
     e.Item.Text = item.Id.ToString();
     e.Item.SubItems.Add(item.Name);
 }
Beispiel #6
0
        private void listViewPrimeNumberList_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            e.Item = new ListViewItem(e.ItemIndex.ToString());

            bool lock_taken = false;
            calculator.BeginAccessData(ref lock_taken);
            e.Item.SubItems.Add(calculator.PrimeNumberList[e.ItemIndex].ToString());
            calculator.EndAccessData();
        }
Beispiel #7
0
        private void ResultList_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            if (e.ItemIndex < _searchResultInfos.Count)
            {
                ListViewItem listViewItem = new ListViewItem { Text = _searchResultInfos[e.ItemIndex].Title };

                e.Item = listViewItem;
            }
        }
Beispiel #8
0
            public ListViewItem this[int displayIndex]
            {
                get
                {
                    owner.ApplyUpdateCachedItems();

                    if (owner.VirtualMode)
                    {
                        // if we are showing virtual items, we need to get the item from the user
                        RetrieveVirtualItemEventArgs rVI = new RetrieveVirtualItemEventArgs(displayIndex);
                        owner.OnRetrieveVirtualItem(rVI);
                        rVI.Item.SetItemIndex(owner, displayIndex);
                        return(rVI.Item);
                    }
                    else
                    {
                        if (displayIndex < 0 || displayIndex >= owner._itemCount)
                        {
                            throw new ArgumentOutOfRangeException(nameof(displayIndex), displayIndex, string.Format(SR.InvalidArgument, nameof(displayIndex), displayIndex));
                        }

                        if (owner.IsHandleCreated && !owner.ListViewHandleDestroyed)
                        {
                            return((ListViewItem)owner._listItemsTable[DisplayIndexToID(displayIndex)]);
                        }
                        else
                        {
                            Debug.Assert(owner._listViewItems is not null, "listItemsArray is null, but the handle isn't created");
                            return(owner._listViewItems[displayIndex]);
                        }
                    }
                }
                set
                {
                    owner.ApplyUpdateCachedItems();
                    if (owner.VirtualMode)
                    {
                        throw new InvalidOperationException(SR.ListViewCantModifyTheItemCollInAVirtualListView);
                    }

                    if (displayIndex < 0 || displayIndex >= owner._itemCount)
                    {
                        throw new ArgumentOutOfRangeException(nameof(displayIndex), displayIndex, string.Format(SR.InvalidArgument, nameof(displayIndex), displayIndex));
                    }

                    if (owner.ExpectingMouseUp)
                    {
                        owner.ItemCollectionChangedInMouseDown = true;
                    }

                    RemoveAt(displayIndex);
                    Insert(displayIndex, value);
                }
            }
Beispiel #9
0
		protected override void OnRetrieveVirtualItem(RetrieveVirtualItemEventArgs e)
		{
			base.OnRetrieveVirtualItem(e);

			if (mCache[e.ItemIndex] != null) {
				e.Item = mCache[e.ItemIndex];
			}
			else {
				ListViewItem item = new ListViewItem(mItems[e.ItemIndex].OrignalLine.Replace("\t", "  "));
				e.Item = item;
				mCache[e.ItemIndex] = item;
			}
		}
Beispiel #10
0
 /// <summary>
 /// Called when the control need a virtual item.
 /// </summary>
 /// <param name="e">The event object the user needs to fill up.</param>
 protected override void OnRetrieveVirtualItem(RetrieveVirtualItemEventArgs e)
 {
     // Get the list view item from the user.
     base.OnRetrieveVirtualItem(e);
     if (e.Item != null)
     {
         // Go over all the sub items in the list view
         foreach (ListViewItem.ListViewSubItem subItem in e.Item.SubItems)
         {
             // If an items text is 260 characters long, add a space so it does
             // not crash the program.
             if (subItem.Text.Length == 260)
             {
                 subItem.Text = subItem.Text + " ";
             }
         }
     }
 }
Beispiel #11
0
 private void RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     if (mCachedItem == null || mLastUpdatedItemIndex != e.ItemIndex)
     {
         e.Item = new ListViewItem(e.ItemIndex.ToString());
         mCachedItem = e.Item;
         StoredLine line = mStorage[e.ItemIndex];
         e.Item.SubItems.Add(mSession.GetTimestamp(line.Ticks));
         e.Item.SubItems.Add(mSession.GetProcessName(line.Pid) ?? line.Pid.ToString());
         e.Item.SubItems.Add(mStorage.GetString(e.ItemIndex));
         mLastUpdatedItemIndex = e.ItemIndex;
     }
     else
     {
         // we cache the listviewitem because the listview requests the same item very often!?
         e.Item = mCachedItem;
     }
 }
Beispiel #12
0
        /***********************************************/

        void listView_players_data_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            try
            {
                e.Item = (ListViewItem)listView_players_data_items[e.ItemIndex];
                return;
            }
            catch
            {
                e.Item = new ListViewItem();
                e.Item.SubItems.Add("");
                e.Item.SubItems.Add("");
                e.Item.SubItems.Add("");
                e.Item.SubItems.Add("");
                e.Item.SubItems.Add("");
                e.Item.ImageIndex = -1; 
            }
        }
Beispiel #13
0
		private void _culturesList_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
		{
			CultureInfo ci = _cultures[e.ItemIndex];
			string[] items;
			Color c;
			if (ci == CultureInfo.InvariantCulture)
			{
				items = new string[] { "(default)", "Default Culture" };
				c = Color.Gray;
			}
			else
			{
				items = new string[] { ci.Name, ci.DisplayName };
				c = Color.Black;
			}
			e.Item = new ListViewItem(items,
				ci.IsNeutralCulture || ci == CultureInfo.InvariantCulture ? 0 : 1);
			e.Item.ForeColor = c;
		}
        private void MemoryView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            ListViewItem theItem;
            int i;
            ulong toRead = mAddress + (ulong)(e.ItemIndex << 4);

            if (mStoredBytes.TryGetValue(toRead, out theItem))
            {
                e.Item = theItem;
                return;
            }

            StringBuilder resultName = new StringBuilder(string.Format("{0:X8}:", toRead));

            for (i = 0; i < 16; i++)
                resultName.Append(" ??");

            e.Item = new ListViewItem(resultName.ToString());
            mStoredBytes[toRead] = e.Item;
            ThreadPool.QueueUserWorkItem(UpdateRow, toRead);
        }
        /// <summary>
        /// Handle a RetrieveVirtualItem
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void HandleRetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) {
            // .NET 2.0 seems to generate a lot of these events. Before drawing *each* sub-item,
            // this event is triggered 4-8 times for the same index. So we save lots of CPU time
            // by caching the last result.
            //System.Diagnostics.Debug.WriteLine(String.Format("HandleRetrieveVirtualItem({0})", e.ItemIndex));

            if (this.lastRetrieveVirtualItemIndex != e.ItemIndex) {
                this.lastRetrieveVirtualItemIndex = e.ItemIndex;
                this.lastRetrieveVirtualItem = this.MakeListViewItem(e.ItemIndex);
            }
            e.Item = this.lastRetrieveVirtualItem;
        }
Beispiel #16
0
 private void EventList_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     if (_ItemCache != null && e.ItemIndex >= _itemCacheIndex && e.ItemIndex < _itemCacheIndex + _ItemCache.Length)
     {
         //キャッシュヒット
         e.Item = _ItemCache[e.ItemIndex - _itemCacheIndex];
     }
     else
     {
         //キャッシュミス
         e.Item = CreateListViewItem(_filterdEventSource[e.ItemIndex]);
     }
 }
Beispiel #17
0
 private void MyList_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     if (_itemCache != null && e.ItemIndex >= _itemCacheIndex && e.ItemIndex < _itemCacheIndex + _itemCache.Length && _curList.Equals(sender))
     {
         //A cache hit, so get the ListViewItem from the cache instead of making a new one.
         e.Item = _itemCache[e.ItemIndex - _itemCacheIndex];
     }
     else
     {
         //A cache miss, so create a new ListViewItem and pass it back.
         TabPage tb = (TabPage)((DetailsListView)sender).Parent;
         try
         {
             e.Item = CreateItem(tb,
                                 _statuses[tb.Text, e.ItemIndex],
                                 e.ItemIndex);
         }
         catch (Exception)
         {
             //不正な要求に対する間に合わせの応答
             string[] sitem = {"", "", "", "", "", "", "", ""};
             e.Item = new ImageListViewItem(sitem, "");
         }
     }
 }
Beispiel #18
0
 private void SpellList_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     e.Item = new ListViewItem(new[] { _spellList[e.ItemIndex].ID.ToString(), _spellList[e.ItemIndex].SpellNameRank });
 }
 private void lstInvoices_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     bool retry = true;
     while (retry)
     {
         try { e.Item = filteredInvoices[e.ItemIndex]; retry = false; }
         catch { retry = true; }
     }
 }
Beispiel #20
0
			ListViewItem RetrieveVirtualItemFromOwner (int displayIndex)
			{
				RetrieveVirtualItemEventArgs args = new RetrieveVirtualItemEventArgs (displayIndex);

				owner.OnRetrieveVirtualItem (args);
				ListViewItem retval = args.Item;
				retval.Owner = owner;
				retval.DisplayIndex = displayIndex;
				retval.Layout ();

				return retval;
			}
 void listView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     e.Item = GetItem(e.ItemIndex);
 }
        private void listViewHistory_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            lock (_document.History)
            {
                if ((e.ItemIndex >= 0) && (e.ItemIndex < _document.History.Count))
                {
                    ConnectionHistoryEntry entry = _document.History[e.ItemIndex];

                    ListViewItem item = new ListViewItem(entry.StartTime.ToString());

                    item.SubItems.Add(entry.EndTime.Subtract(entry.StartTime).ToString());
                    item.SubItems.Add(entry.NetworkDescription);
                    item.Tag = entry;

                    e.Item = item;
                }
                else
                {
                    // Return a dummy item
                    ListViewItem item = new ListViewItem("");
                    item.SubItems.Add("");
                    item.SubItems.Add("");
                    e.Item = item;
                }
            }
        }
Beispiel #23
0
 private void listLog_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     e.Item = new ListViewItem(new string[]
     {
         Program.HackerWindow.Log[e.ItemIndex].Key.ToString(),
         Program.HackerWindow.Log[e.ItemIndex].Value
     });
 }
Beispiel #24
0
 /// <summary>
 /// The basic VirtualMode function.  Dynamically returns a ListViewItem
 /// with the required properties; in this case, the square of the index.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void listView1_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     //check to see if the requested item is currently in the cache
     if (DisplayObjectsCache != null && e.ItemIndex >= IndexOfFirstItemInCache && e.ItemIndex < IndexOfFirstItemInCache + DisplayObjectsCache.Length)
     {
         //A cache hit, so get the ListViewItem from the cache instead of making a new one.
         e.Item = DisplayObjectsCache[e.ItemIndex - IndexOfFirstItemInCache];
     }
     else
     {
         //A cache miss, so create a new ListViewItem and pass it back.
         e.Item = CreateItemFromIndex(e.ItemIndex);
     }
 }
Beispiel #25
0
		void ListViewRetrieveVirtualItemHandler (object o, RetrieveVirtualItemEventArgs args)
		{
			args.Item = items [args.ItemIndex];
		}
Beispiel #26
0
 private void _lvSqlData_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     e.Item = new ListViewItem(MySQLConnect.SpellProcEvent[e.ItemIndex].ToArray());
 }
		/// <summary>
		//The Shift Key + mouse click event 
		/// </summary>
		void listView1_RetrieveVirtualItem(object sender,RetrieveVirtualItemEventArgs e)
		{
			clwCategoryView.RetrieveVirtualItem -= new RetrieveVirtualItemEventHandler(listView1_RetrieveVirtualItem);
			SetCommandExecutableStatus();
		}
 private void lstInventorySearch_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     if (searchItemCache.ContainsKey(e.ItemIndex))
     {
         e.Item = searchItemCache[e.ItemIndex];
     }
     else if (e.ItemIndex < searchRes.Count)
     {
         InventoryBase inv = searchRes[e.ItemIndex].Inv;
         string desc = inv.Name;
         if (inv is InventoryItem)
         {
             desc += string.Format(" - {0}", ((InventoryItem)inv).Description);
         }
         ListViewItem item = new ListViewItem(desc);
         item.Tag = searchRes[e.ItemIndex];
         e.Item = item;
         searchItemCache[e.ItemIndex] = item;
     }
     else
     {
         e.Item = emptyItem;
     }
 }
Beispiel #29
0
        // Vitual ListView wants data
        private void keywordsListView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            int i = e.ItemIndex;
            ListViewItem li = new ListViewItem((i + 1).ToString());

            if (_helpKeywords == null || i >= _helpKeywords.Count)  //range check
            {
                e.Item = GetListViewItem(i, "??", false, 0);
                return;
            }

            //Note: We can improve speed and smoothness with some local caching

            int topicCount;
            Keyword keyword = indexCache.GetKW(i, out topicCount);
            if (keyword == null)
            {
                _helpKeywords.MoveTo(i);
                keyword = (Keyword)_helpKeywords.Current;
                topicCount = keyword.Topics.Count;
                indexCache.Add(i, keyword, topicCount);
            }

            String kwText = keyword.DisplayValue;
            if (keyword.IsSubkey)
                kwText = "    " + kwText;
            e.Item = GetListViewItem(i, kwText, keyword.IsSubkey, topicCount);
        }
Beispiel #30
0
		protected virtual void OnRetrieveVirtualItem (RetrieveVirtualItemEventArgs e)
		{
			RetrieveVirtualItemEventHandler eh = (RetrieveVirtualItemEventHandler)Events [RetrieveVirtualItemEvent];
			if (eh != null)
				eh (this, e);
		}
Beispiel #31
0
 /// <summary>
 /// Retrieve an item for display in the listview, first trying the cache
 /// </summary>        
 private void listViewSessions_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     lock (m_SessionViewCache)
     {
         if (m_SessionViewCache.ContainsKey(e.ItemIndex))
         {
             e.Item = m_SessionViewCache[e.ItemIndex];
         }
         else
         {
             e.Item = GenerateListViewItem(e.ItemIndex);
             m_SessionViewCache.Add(e.ItemIndex, e.Item);
         }
     }
 }
Beispiel #32
0
 protected virtual void OnRetrieveVirtualItem(RetrieveVirtualItemEventArgs e)
 {
     throw null;
 }