示例#1
0
 public void InsertAfter(PuzzleItem item, int slot)
 {
     if (DeleteAtEnd)
     {
         if (PuzzleItems.Count >= gridSize)
         {
             if (OverloadDumpSite != null)
             {
                 OverloadDumpSite.InsertBefore(PuzzleItems[gridSize - 1], 0);
             }
             PuzzleItems.Remove(PuzzleItems[gridSize - 1]);
         }
         if (PuzzleItems.Count >= gridSize)
         {
             try
             {
                 PuzzleItems.RemoveAt(gridSize);
                 foreach (PuzzleItem anItem in aListOfSelectedItems)
                 {
                     if (!PuzzleItems.Contains(anItem))
                     {
                         aListOfSelectedItems.Remove(anItem);
                     }
                 }
             }
             catch { /*happens when window is resized (sometimes)*/ }
         }
     }
     PuzzleItems.Insert(slot + 1, item);
     Invalidate();
 }
示例#2
0
 public void InsertBefore(PuzzleItem item, int slot)
 {
     if (slot >= 32)
     {
         if (OverloadDumpSite != null)
         {
             OverloadDumpSite.InsertBefore(item, 0);
         }
     }
     else
     {
         if (DeleteAtEnd)
         {
             if (PuzzleItems.Count >= gridSize)
             {
                 if (OverloadDumpSite != null)
                 {
                     OverloadDumpSite.InsertBefore(PuzzleItems[gridSize - 1], 0);
                 }
                 PuzzleItems.Remove(PuzzleItems[gridSize - 1]);
             }
             if (PuzzleItems.Count >= gridSize)
             {
                 try
                 {
                     PuzzleItems.RemoveAt(gridSize);
                     foreach (PuzzleItem anItem in aListOfSelectedItems)
                     {
                         if (!PuzzleItems.Contains(anItem))
                         {
                             aListOfSelectedItems.Remove(anItem);
                         }
                     }
                 }
                 catch { /*happens when window is resized (sometimes... and things break) */ }
             }
         }
         PuzzleItems.Insert(slot, item);//todo: fix crash when Item dragged too deep onto the palette
     }
     Invalidate();
 }