private void HandleDropCommand(DragEventArgs args)
        {
            IDataObject data = args.Data;

            if (data.GetDataPresent(SerializableNameUtils.GetName(DragDataType.LayerListNode)))
            {
                ILayer draggedLayer = data.GetData(SerializableNameUtils.GetName(DragDataType.LayerListNode)) as ILayer;
                if (draggedLayer != null)
                {
                    if (this.IsDragAbove.Value)
                    {
                        this.layer.AddLayerAbove(draggedLayer);
                    }
                    else if (this.IsDragOnto.Value)
                    {
                        this.layer.AddLayer(draggedLayer);
                    }
                    else if (this.IsDragBelow.Value)
                    {
                        this.layer.AddLayerBelow(draggedLayer);
                    }
                }
            }
            this.IsDragAbove.Value = false;
            this.IsDragOnto.Value  = false;
            this.IsDragBelow.Value = false;
            args.Handled           = true;
        }
Exemplo n.º 2
0
        private void StartDrag(MouseEventArgs args)
        {
            this.isDragging = true;

            DataObject       data       = new DataObject(SerializableNameUtils.GetName(DragDataType.LayerListNode), this.Layer);
            DependencyObject dragSource = args.Source as DependencyObject;

            DragDrop.DoDragDrop(dragSource, data, DragDropEffects.Move);

            this.isDragging = false;
        }
Exemplo n.º 3
0
        private void HandleDropCommand(DragEventArgs args)
        {
            IDataObject data = args.Data;

            if (data.GetDataPresent(SerializableNameUtils.GetName(DragDataType.ExplorerMapNode)))
            {
                Map draggedMap = data.GetData(SerializableNameUtils.GetName(DragDataType.ExplorerMapNode)) as Map;
                this.Project.Maps.Insert(0, draggedMap);
            }
            this.IsDragAbove.Value = false;
            this.IsDragOnto.Value  = false;
            this.IsDragBelow.Value = false;
            args.Handled           = true;
        }
Exemplo n.º 4
0
        private void HandleDropCommand(DragEventArgs args)
        {
            IDataObject data = args.Data;

            if (data.GetDataPresent(SerializableNameUtils.GetName(DragDataType.LayerListNode)))
            {
                ILayer draggedLayer = data.GetData(SerializableNameUtils.GetName(DragDataType.LayerListNode)) as ILayer;
                this.Session.CurrentMap.Value.AddLayer(draggedLayer);
            }
            args.Handled = true;

            ILayerListNodeViewModel lastLayertNode = this.LayerNodes.Last <ILayerListNodeViewModel>();

            lastLayertNode.IsDragBelow.Value = false;
        }
Exemplo n.º 5
0
        private void HandleDragEnterCommand(DragEventArgs args)
        {
            IDataObject data = args.Data;

            if (!data.GetDataPresent(SerializableNameUtils.GetName(DragDataType.LayerListNode)))
            {
                return;
            }
            ILayer draggedLayer = data.GetData(SerializableNameUtils.GetName(DragDataType.LayerListNode)) as ILayer;

            if (draggedLayer == this.Layer)
            {
                return;
            }
            DrawSeparator(args);
            args.Handled = true;
        }
Exemplo n.º 6
0
        private void HandleDropCommand(DragEventArgs args)
        {
            IDataObject data = args.Data;

            if (data.GetDataPresent(SerializableNameUtils.GetName(DragDataType.ExplorerLayerNode)))
            {
                ILayer draggedLayer = data.GetData(SerializableNameUtils.GetName(DragDataType.ExplorerLayerNode)) as ILayer;
                this.Map.Layers.Insert(0, draggedLayer);
            }
            else if (data.GetDataPresent(SerializableNameUtils.GetName(DragDataType.ExplorerMapNode)))
            {
                Map draggedMap = data.GetData(SerializableNameUtils.GetName(DragDataType.ExplorerMapNode)) as Map;
            }
            else if (data.GetDataPresent(SerializableNameUtils.GetName(DragDataType.ExplorerProjectNode)))
            {
                Project draggedProject = data.GetData(SerializableNameUtils.GetName(DragDataType.ExplorerMapNode)) as Project;
            }
            this.IsDragAbove.Value = false;
            this.IsDragOnto.Value  = false;
            this.IsDragBelow.Value = false;
            args.Handled           = true;
        }
        private void DrawSeparator(DragEventArgs args)
        {
            IDataObject data = args.Data;

            if (!data.GetDataPresent(SerializableNameUtils.GetName(DragDataType.LayerListNode)))
            {
                return;
            }
            ILayer draggedLayer = data.GetData(SerializableNameUtils.GetName(DragDataType.LayerListNode)) as ILayer;

            if (draggedLayer == this.layer)
            {
                return;
            }
            UIElement dragSource   = args.Source as UIElement;
            double    heightMiddle = dragSource.RenderSize.Height / 2;

            bool isBelow = args.GetPosition(dragSource).Y - heightMiddle > 0;

            this.IsDragAbove.Value = !isBelow;
            this.IsDragBelow.Value = isBelow;
        }