Beispiel #1
0
        private void m_RefreshList(CkernelGateway in_krnGateway)
        {
            //refresh 30 items each second
            itemsToRemove.Clear();
            int          nRefreshed = 0;
            int          nItem      = 0;
            bool         refresh;
            ListViewItem Item;

            while (nItem < Items.Count)
            {
                Item = Items[nItem];
                if (Item == null)
                {
                    break;
                }
                InterfaceClient sourceant = (InterfaceClient)Item.Tag;

                refresh = false;
                if ((nItem >= m_LastItem) && (nItem <= m_LastItem + 30))         //only refresh not queued sources
                {
                    refresh = true;
                }
                if ((sourceant.DownloadState != 2) && (sourceant.DownloadState != 6))
                {
                    refresh = true;
                }
                if (refresh)
                {
                    nRefreshed++;
                    InterfaceClient source = in_krnGateway.GetDownloadClient(sourceant.ID, sourceant.Port, sourceant.ServerIP, sourceant.UserHash, strFileHash);
                    if (source == null)
                    {
                        itemsToRemove.Add(Item);
                    }
                    else
                    {
                        SourceToItem(source, Item);
                    }
                }
                nItem++;
            }
            m_LastItem += 30;
            if (m_LastItem >= Items.Count)
            {
                m_LastItem = 0;
            }
            foreach (ListViewItem ItemRemove in itemsToRemove)
            {
                this.Items.Remove(ItemRemove);
            }
            //Debug.WriteLine("Refreshed: "+ nRefreshed.ToString() +" : "+m_LastItem.ToString());
        }
		private void m_RefreshList(CkernelGateway in_krnGateway)
		{
			//refresh 30 items each second
			itemsToRemove.Clear();
			int nRefreshed=0;
			int nItem=0;
			bool refresh;
			ListViewItem Item;
			while (nItem<Items.Count)
			{
				Item=Items[nItem];
				if (Item==null) break;
				InterfaceClient sourceant=(InterfaceClient)Item.Tag;

				refresh=false;
				if ((nItem>=m_LastItem)&&(nItem<=m_LastItem+30)) //only refresh not queued sources
				{
					refresh=true;
				}
				if ((sourceant.DownloadState!=2)&&(sourceant.DownloadState!=6))
					refresh=true;
				if (refresh)
				{
					nRefreshed++;
					InterfaceClient source=in_krnGateway.GetDownloadClient(sourceant.ID,sourceant.Port,sourceant.ServerIP,sourceant.UserHash,strFileHash);
					if (source==null) itemsToRemove.Add(Item);
						else SourceToItem(source,Item);
				}
				nItem++;
				
			}
			m_LastItem+=30;
			if (m_LastItem>=Items.Count) m_LastItem=0;
			foreach (ListViewItem ItemRemove in itemsToRemove)
			{
				this.Items.Remove(ItemRemove);
			}
			//Debug.WriteLine("Refreshed: "+ nRefreshed.ToString() +" : "+m_LastItem.ToString());
		}