Beispiel #1
0
 public void Add(UIItems pairedItems)
 {
     if (items != null)
     {
         items.Add(pairedItems);
     }
 }
Beispiel #2
0
        public static UIItemsList GetUIItemsList(IList <Item> list)
        {
            UIItemsList itemsList   = new UIItemsList();
            UIItems     pairedItems = new UIItems();

            for (int i = 0; i <= list.Count - 1; i++)
            {
                var item = list[i];
                if (pairedItems == null)
                {
                    pairedItems = new UIItems();
                }

                if (pairedItems.Item1 == null)
                {
                    pairedItems.Item1 = item;
                    if (i == list.Count - 1)
                    {
                        itemsList.Add(pairedItems);
                        pairedItems = null;
                    }
                }
                else if (pairedItems.Item2 == null)
                {
                    pairedItems.Item2 = item;
                    itemsList.Add(pairedItems);
                    pairedItems = null;
                }
                else
                {
                    pairedItems       = new UIItems();
                    pairedItems.Item1 = item;
                }
            }
            return(itemsList);
        }