Example #1
0
        public static void MoveSelectedItemsInternalOne <T>(ListView lv,
                                                            PwObjectList <T> v, bool bUp)
            where T : class, IDeepCloneable <T>
        {
            if (lv == null)
            {
                throw new ArgumentNullException("lv");
            }
            if (v == null)
            {
                throw new ArgumentNullException("v");
            }
            if (lv.Items.Count != (int)v.UCount)
            {
                throw new ArgumentException();
            }

            ListView.SelectedListViewItemCollection lvsic = lv.SelectedItems;
            if (lvsic.Count == 0)
            {
                return;
            }

            int nStart = (bUp ? 0 : (lvsic.Count - 1));
            int nEnd   = (bUp ? lvsic.Count : -1);

            for (int i = nStart; i != nEnd; i += (bUp ? 1 : -1))
            {
                v.MoveOne(lvsic[i].Tag as T, bUp);
            }
        }