예제 #1
0
        private void TourStopList_MouseUp(object sender, MouseEventArgs e)
        {
            dragging  = false;
            mouseDown = false;
            scrolling = false;
            if (dragThumbnail != null)
            {
                if (dragItem > -1 && dragItem != dragDropItemLocation)
                {
                    if (dragDropItemLocation != -1)
                    {
                        if (dragDropItemLocation == -2)
                        {
                            dragDropItemLocation = Items.Count;
                        }

                        List <TourStop> dragItems = new List <TourStop>();
                        foreach (int itemId in SelectedItems.Keys)
                        {
                            dragItems.Add(Items[itemId]);
                        }

                        //TourStop ts = Items[dragItem];
                        if (Control.ModifierKeys != Keys.Control)
                        {
                            Undo.Push(new UndoTourSlidelistChange(Language.GetLocalizedText(550, "Move Slide"), Tour));

                            foreach (TourStop ts in dragItems)
                            {
                                Items.Remove(ts);
                            }

                            int itemCount = 0;
                            foreach (int selIndex in SelectedItems.Keys)
                            {
                                if (dragDropItemLocation > dragItem)
                                {
                                    itemCount++;
                                }
                            }

                            dragDropItemLocation -= itemCount;
                            SelectedItems.Clear();

                            foreach (TourStop ts in dragItems)
                            {
                                Items.Insert(dragDropItemLocation, ts);
                                SelectedItems.Add(dragDropItemLocation, Items[dragDropItemLocation]);
                                dragDropItemLocation++;
                            }
                        }
                        else
                        {
                            Undo.Push(new UndoTourSlidelistChange(Language.GetLocalizedText(539, "Drag Copy"), Tour));
                            SelectedItems.Clear();
                            foreach (TourStop ts in dragItems)
                            {
                                Items.Insert(dragDropItemLocation, ts.Copy());
                                SelectedItems.Add(dragDropItemLocation, Items[dragDropItemLocation]);
                                dragDropItemLocation++;
                            }
                        }

                        Tour.CurrentTourstopIndex = selectedItem = dragDropItemLocation;

                        Refresh();
                    }
                }
                dragThumbnail.Close();
                dragThumbnail.Dispose();
                dragThumbnail = null;
            }
            dragDropItemLocation = -1;
            dragItem             = -1;
        }