Esempio n. 1
0
        public ICommand Create(OLVDataObject o)
        {
            if (o == null || o.ModelObjects == null)
            {
                return(null);
            }

            //does the data object already contain a command?
            if (o.ModelObjects.OfType <ICommand>().Count() == 1)
            {
                return(o.ModelObjects.OfType <ICommand>().Single());//yes
            }
            //otherwise is it something that can be turned into a command?
            if (o.ModelObjects.Count == 0)
            {
                return(null);
            }

            //try to create command from the single data object
            if (o.ModelObjects.Count == 1)
            {
                return(Create(o.ModelObjects[0]));
            }

            //try to create command from all the data objects as an array
            return(Create(o.ModelObjects.Cast <object>().ToArray()));
        }
Esempio n. 2
0
        /// <summary>
        /// The drag operation is finished. Refreshes the dragged rows if so configured.
        /// </summary>
        /// <param name="dragObject"></param>
        /// <param name="effect"></param>
        public virtual void EndDrag(object dragObject, DragDropEffects effect)
        {
            OLVDataObject data = dragObject as OLVDataObject;

            if (data == null)
            {
                return;
            }

            if (this.RefreshAfterDrop)
            {
                data.ListView.RefreshObjects(data.ModelObjects);
            }
        }
Esempio n. 3
0
        private void ObjectListView1Dropped(object sender, OlvDropEventArgs e)
        {
            OLVDataObject o = e.DataObject as OLVDataObject;

            if (o != null)
            {
                List <TableBlock> blocks = new List <TableBlock>();
                foreach (TableBlock block in o.ModelObjects)
                {
                    blocks.Add(block);
                }

                this.MoveBlocks(blocks, e.DropTargetIndex);
            }
        }
Esempio n. 4
0
        private AdvertisedPipelineComponentTypeUnderContext GetAdvertisedObjectFromDragOperation(DragEventArgs e)
        {
            OLVDataObject dataObject = e.Data as OLVDataObject;

            if (dataObject != null)
            {
                if (dataObject.ModelObjects.Count == 1 &&
                    dataObject.ModelObjects[0] is AdvertisedPipelineComponentTypeUnderContext)
                {
                    return((AdvertisedPipelineComponentTypeUnderContext)dataObject.ModelObjects[0]);
                }

                return(null);
            }
            return(null);
        }