Example #1
0
 private void _pictureBox_DragEnter(Object sender, DragEventArgs e)
 {
     if (NuGenArgument.GetCompatibleDataObjectType(e.Data, typeof(IDescriptor)) != null)
     {
         e.Effect = DragDropEffects.Copy;
     }
 }
Example #2
0
        private void _pictureBox_DragDrop(Object sender, DragEventArgs e)
        {
            Type        descriptorType = NuGenArgument.GetCompatibleDataObjectType(e.Data, typeof(IDescriptor));
            IDescriptor descriptor     = (IDescriptor)e.Data.GetData(descriptorType);
            NodeBase    nodeToAdd      = descriptor.CreateNode(this);
            Point       cp             = _pictureBox.PointToClient(new Point(e.X, e.Y));

            AddNode(nodeToAdd, new Point((Int32)(cp.X / _scale), (Int32)(cp.Y / _scale)));
        }
Example #3
0
        public void GetCompatibleDataObjectTypeInheritanceTest()
        {
            Assert.AreEqual(
                typeof(Button),
                NuGenArgument.GetCompatibleDataObjectType(_dataObject, typeof(Control))
                );

            Assert.IsNull(
                NuGenArgument.GetCompatibleDataObjectType(_dataObject, typeof(TextBox))
                );
        }
Example #4
0
        public void GetCompatibleDataObjectTypeInterfaceTest()
        {
            MockDataTarget mockDataTarget = new MockDataTarget();

            Assert.AreEqual(
                typeof(MockDataTarget),
                NuGenArgument.GetCompatibleDataObjectType(new DataObject(mockDataTarget), typeof(IMockDataTarget))
                );

            Assert.IsNull(
                NuGenArgument.GetCompatibleDataObjectType(_dataObject, typeof(IMockObject))
                );
        }
Example #5
0
        /*
         * OnDragEnter
         */

        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.DragEnter"></see> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.DragEventArgs"></see> that contains the event data.</param>
        protected override void OnDragEnter(DragEventArgs e)
        {
            if (NuGenArgument.GetCompatibleDataObjectType(e.Data, typeof(NuGenTaskTreeNodeBase)) != null)
            {
                e.Effect = DragDropEffects.Move;
            }
            else
            {
                e.Effect = DragDropEffects.None;
            }

            base.OnDragEnter(e);
        }
Example #6
0
 public void GetCompatibleDataObjectTypeArgumentNullExceptionOnCompatibleType()
 {
     NuGenArgument.GetCompatibleDataObjectType(_dataObject, null);
 }
Example #7
0
 public void GetCompatibleDataObjectTypeArgumentNullExceptionOnDataObject()
 {
     NuGenArgument.GetCompatibleDataObjectType(null, typeof(IMockDataTarget));
 }