コード例 #1
0
ファイル: ResultsView.cs プロジェクト: mausch/NHWorkbench
 void listViewResults_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     if (e.ItemIndex >= 0 && e.ItemIndex < dataStream.Length)
     {
         e.Item = new ListViewItem(dataStream[e.ItemIndex]);
     }
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: ehershey/development
		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());
		}
コード例 #3
0
ファイル: MotionPanel.cs プロジェクト: ousttrue/csmeshio
 void OnRetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     var item=_vmd.BoneMotions[e.ItemIndex];
     e.Item = new ListViewItem(new string[]{
             item.BoneName,
             item.FrameNum.ToString()
             });
 }
コード例 #4
0
ファイル: FormMain.cs プロジェクト: bobby1212/VehicleGarage
        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()});
        }
コード例 #5
0
 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);
 }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: EFanZh/EFanZh
        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();
        }
コード例 #7
0
ファイル: SearchForm.cs プロジェクト: ozok/TRadioPlayer
        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;
            }
        }
コード例 #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);
                }
            }
コード例 #9
0
ファイル: ToolTipListBox.cs プロジェクト: Orvid/Cosmos
		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;
			}
		}
コード例 #10
0
ファイル: SafeListView.cs プロジェクト: jkowalski/NLogViewer
 /// <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 + " ";
             }
         }
     }
 }
コード例 #11
0
ファイル: DBWinListView.cs プロジェクト: apakian/buggazer
 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;
     }
 }
コード例 #12
0
ファイル: L2NET_Timers.cs プロジェクト: stephenZh/l2net
        /***********************************************/

        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; 
            }
        }
コード例 #13
0
ファイル: CultureManagerForm.cs プロジェクト: rsdn/janus
		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;
		}
コード例 #14
0
        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);
        }
コード例 #15
0
        /// <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;
        }
コード例 #16
0
ファイル: EventViewerDialog.cs プロジェクト: egcube/OpenTween
 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]);
     }
 }
コード例 #17
0
ファイル: Tween.cs プロジェクト: lupeeloveee/OpenTween
 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, "");
         }
     }
 }
コード例 #18
0
ファイル: FormSearch.cs プロジェクト: rescript/spellwork_cs
 private void SpellList_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     e.Item = new ListViewItem(new[] { _spellList[e.ItemIndex].ID.ToString(), _spellList[e.ItemIndex].SpellNameRank });
 }
コード例 #19
0
 private void lstInvoices_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     bool retry = true;
     while (retry)
     {
         try { e.Item = filteredInvoices[e.ItemIndex]; retry = false; }
         catch { retry = true; }
     }
 }
コード例 #20
0
ファイル: ListView.cs プロジェクト: KonajuGames/SharpLang
			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;
			}
コード例 #21
0
 void listView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     e.Item = GetItem(e.ItemIndex);
 }
コード例 #22
0
        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;
                }
            }
        }
コード例 #23
0
ファイル: LogWindow.cs プロジェクト: andyvand/ProcessHacker
 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
     });
 }
コード例 #24
0
ファイル: MainForm.cs プロジェクト: zippy1981/GTools
 /// <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);
     }
 }
コード例 #25
0
ファイル: ListViewTest.cs プロジェクト: Profit0004/mono
		void ListViewRetrieveVirtualItemHandler (object o, RetrieveVirtualItemEventArgs args)
		{
			args.Item = items [args.ItemIndex];
		}
コード例 #26
0
ファイル: FormMain.cs プロジェクト: Gintama/spellwork_cs
 private void _lvSqlData_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
 {
     e.Item = new ListViewItem(MySQLConnect.SpellProcEvent[e.ItemIndex].ToArray());
 }
コード例 #27
0
		/// <summary>
		//The Shift Key + mouse click event 
		/// </summary>
		void listView1_RetrieveVirtualItem(object sender,RetrieveVirtualItemEventArgs e)
		{
			clwCategoryView.RetrieveVirtualItem -= new RetrieveVirtualItemEventHandler(listView1_RetrieveVirtualItem);
			SetCommandExecutableStatus();
		}
コード例 #28
0
 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;
     }
 }
コード例 #29
0
ファイル: Page_Keywords.cs プロジェクト: bencz/OrangeC
        // 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);
        }
コード例 #30
0
ファイル: ListView.cs プロジェクト: KonajuGames/SharpLang
		protected virtual void OnRetrieveVirtualItem (RetrieveVirtualItemEventArgs e)
		{
			RetrieveVirtualItemEventHandler eh = (RetrieveVirtualItemEventHandler)Events [RetrieveVirtualItemEvent];
			if (eh != null)
				eh (this, e);
		}
コード例 #31
0
ファイル: FormWinGridProxy.cs プロジェクト: RavenB/gridsearch
 /// <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);
         }
     }
 }
コード例 #32
0
 protected virtual void OnRetrieveVirtualItem(RetrieveVirtualItemEventArgs e)
 {
     throw null;
 }