예제 #1
0
        internal void UpdateList(PazPar2Show pp2Show)
        {
            LastMergeCount = pp2Show.merged;
            LastUpdateTime = DateTime.Now;
            List <Hit> sList = pp2Show.Hits;

            Hits.RemoveAll();
            foreach (Hit hit in pp2Show.Hits)
            {
                Hits.Add(hit);
            }

            Pici.Log.debug(typeof(Page), "FireListUpdated for page " + Index);
            Hits.FireListUpdated();

            //bool isUpdated = false;
            //ItemList<Hit> tList = Hits;
            ////remove items not in current list
            //IEnumerable<Hit> toRemove = from sHit in sList where !tList.Contains<Hit>(sHit) select sHit;
            //foreach (var item in toRemove.ToList())
            //{
            //    isUpdated = isUpdated || tList.Remove(item);
            //}

            ////insert missing items
            //for (int idx = 0; idx < sList.Count; idx++)
            //{
            //    Hit sItem = sList.ElementAt(idx);
            //    if (tList.Count <= idx || !sItem.Equals(tList.ElementAt(idx)))
            //    {
            //        tList.Insert(idx, sItem);
            //        isUpdated = true;
            //        //Task t = await  PP2_Record(sItem));
            //    }
            //}

            ////remove 'tail' of sourceList (items which moved up in position are inserted before and the old instance is still at the end of the list)
            //while (tList.Count > sList.Count)
            //{
            //    tList.RemoveAt(sList.Count);
            //    isUpdated = true;
            //}

            //if (isUpdated)
            //{
            //    Pici.Log.debug(typeof(Page), "FireListUpdated for page " + Index);
            //    tList.FireListUpdated();
            //}
        }