示例#1
0
 void AllowDrag(DragEventArgs e)
 {
     if (_dropEnabledActivityDesignerUtils != null)
     {
         var dropEnabled = _dropEnabledActivityDesignerUtils.LimitDragDropOptions(e.Data);
         if (!dropEnabled)
         {
             e.Effects = DragDropEffects.None;
             e.Handled = true;
         }
     }
 }
示例#2
0
        void DoDrop(object sender, DragEventArgs e)
        {
            var dataObject = e.Data;

            if (_dropEnabledActivityDesignerUtils != null)
            {
                var dropEnabled = _dropEnabledActivityDesignerUtils.LimitDragDropOptions(dataObject);
                if (!dropEnabled)
                {
                    e.Effects = DragDropEffects.None;
                    e.Handled = true;
                }
                else
                {
                    if (ForeachDesignerViewModel.MultipleItemsToSequence(dataObject))
                    {
                        e.Effects = DragDropEffects.None;
                        e.Handled = true;
                    }
                }
            }
            var multipleItemsToSequence = ForeachDesignerViewModel.MultipleItemsToSequence(dataObject);

            if (multipleItemsToSequence)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
            }
        }
示例#3
0
 void DropPointOnDragEnter(object sender, DragEventArgs e)
 {
     if (_dropEnabledActivityDesignerUtils != null)
     {
         var dropEnabled = _dropEnabledActivityDesignerUtils.LimitDragDropOptions(e.Data);
         if (!dropEnabled)
         {
             e.Effects = DragDropEffects.None;
             e.Handled = true;
         }
     }
 }
示例#4
0
        public void ForeachActivityDesignerUtils_LimitDragDropOptions_NoWorkflowItemTypeNameFormatAndNoModelItemFormat_EnableDrop()
        {
            //------------Setup for test--------------------------
            var activityDesignerUtils = new DropEnabledActivityDesignerUtils();
            var dataObject            = new Mock <IDataObject>();

            dataObject.Setup(o => o.GetFormats()).Returns(new[] { "SomeOtherFormat" });
            //------------Execute Test---------------------------
            var dropEnabled = activityDesignerUtils.LimitDragDropOptions(dataObject.Object);

            //------------Assert Results-------------------------
            Assert.IsTrue(dropEnabled);
        }
示例#5
0
        public void ForeachActivityDesignerUtils_LimitDragDropOptions_NoFormats_EnableDrop()
        {
            //------------Setup for test--------------------------
            var activityDesignerUtils = new DropEnabledActivityDesignerUtils();
            var dataObject            = new Mock <IDataObject>();

            dataObject.Setup(o => o.GetFormats()).Returns(new string[] { });
            //------------Execute Test---------------------------
            var dropEnabled = activityDesignerUtils.LimitDragDropOptions(dataObject.Object);

            //------------Assert Results-------------------------
            Assert.IsTrue(dropEnabled);
        }
示例#6
0
        public void ForeachActivityDesignerUtils_LimitDragDropOptions_ModelItemFormat_Decision_DropPrevented()
        {
            //------------Setup for test--------------------------
            var activityDesignerUtils = new DropEnabledActivityDesignerUtils();
            var dataObject            = new Mock <IDataObject>();

            dataObject.Setup(o => o.GetFormats()).Returns(new[] { "ModelItemFormat" });
            dataObject.Setup(o => o.GetData(It.IsAny <string>())).Returns("Decision");
            //------------Execute Test---------------------------
            var dropEnabled = activityDesignerUtils.LimitDragDropOptions(dataObject.Object);

            //------------Assert Results-------------------------
            Assert.IsFalse(dropEnabled);
        }
示例#7
0
        public void ForeachActivityDesignerUtils_LimitDragDropOptions_WorkflowItemTypeNameFormat_NotSwitch_DropNotPrevented()
        {
            //------------Setup for test--------------------------
            var activityDesignerUtils = new DropEnabledActivityDesignerUtils();
            var dataObject            = new Mock <IDataObject>();

            dataObject.Setup(o => o.GetFormats()).Returns(new[] { "WorkflowItemTypeNameFormat" });
            dataObject.Setup(o => o.GetData(It.IsAny <string>())).Returns("Activity");
            //------------Execute Test---------------------------
            var dropEnabled = activityDesignerUtils.LimitDragDropOptions(dataObject.Object);

            //------------Assert Results-------------------------
            Assert.IsTrue(dropEnabled);
        }
示例#8
0
        void DoDrop(object sender, DragEventArgs e)
        {
            var dataObject = e.Data;

            if (_dropEnabledActivityDesignerUtils != null)
            {
                var dropEnabled = _dropEnabledActivityDesignerUtils.LimitDragDropOptions(dataObject);
                if (!dropEnabled)
                {
                    e.Effects = DragDropEffects.None;
                    e.Handled = true;
                }
            }
        }
示例#9
0
 private void DropPoint_OnPreviewDrop(object sender, DragEventArgs e)
 {
     if (DataContext is SuspendExecutionDesignerViewModel viewModel)
     {
         if (_dropEnabledActivityDesignerUtils != null)
         {
             var dropEnabled = _dropEnabledActivityDesignerUtils.LimitDragDropOptions(e.Data);
             if (!dropEnabled)
             {
                 e.Effects = DragDropEffects.None;
                 e.Handled = true;
             }
         }
     }
     DropPoint.Item = null;
 }
示例#10
0
 void DoDrop(object sender, DragEventArgs e)
 {
     if (_dropEnabledActivityDesignerUtils != null)
     {
         var dropEnabled = _dropEnabledActivityDesignerUtils.LimitDragDropOptions(e.Data);
         if (!dropEnabled)
         {
             e.Effects = DragDropEffects.None;
             e.Handled = true;
         }
     }
     if (ViewModel.TrySetModelItemForServiceTypes(e.Data))
     {
         e.Handled = true;
     }
 }
示例#11
0
        public void ForeachActivityDesignerUtils_LimitDragDropOptions_WorkflowItemTypeNameFormat_SwitchModelItem_DropPrevented()
        {
            //------------Setup for test--------------------------
            var activityDesignerUtils = new DropEnabledActivityDesignerUtils();
            var dataObject            = new Mock <IDataObject>();

            dataObject.Setup(o => o.GetFormats()).Returns(new[] { "WorkflowItemTypeNameFormat" });
            var modelItem = ModelItemUtils.CreateModelItem(new FlowSwitch <string>());

            dataObject.Setup(o => o.GetData(It.IsAny <string>())).Returns(modelItem);
            //------------Execute Test---------------------------
            var dropEnabled = activityDesignerUtils.LimitDragDropOptions(dataObject.Object);

            //------------Assert Results-------------------------
            Assert.IsFalse(dropEnabled);
        }
示例#12
0
        public void ForeachActivityDesignerUtils_LimitDragDropOptions_ModelItemFormat_NotSwitchDecision_DropNotPrevented()
        {
            //------------Setup for test--------------------------
            var activityDesignerUtils = new DropEnabledActivityDesignerUtils();
            var dataObject            = new Mock <IDataObject>();

            dataObject.Setup(o => o.GetFormats()).Returns(new[] { "ModelItemFormat" });
            var modelItem = ModelItemUtils.CreateModelItem(new DsfMultiAssignActivity());

            dataObject.Setup(o => o.GetData(It.IsAny <string>())).Returns(modelItem);
            //------------Execute Test---------------------------
            var dropEnabled = activityDesignerUtils.LimitDragDropOptions(dataObject.Object);

            //------------Assert Results-------------------------
            Assert.IsTrue(dropEnabled);
        }
        public void ForeachActivityDesignerUtils_LimitDragDropOptions_WorkflowItemTypeNameFormat_SelectAndApplyModelItem_DropPrevented()
        {
            //------------Setup for test--------------------------
            var activityDesignerUtils = new DropEnabledActivityDesignerUtils();
            var dataObject            = new Mock <IDataObject>();

            dataObject.Setup(o => o.GetFormats()).Returns(new[] { "WorkflowItemTypeNameFormat" });
            dataObject.Setup(o => o.GetData(It.IsAny <string>())).Returns("SelectAndApply");
            //------------Execute Test---------------------------
            var shell = new Mock <IShellViewModel>();

            CustomContainer.Register(shell.Object);
            var dropEnabled = activityDesignerUtils.LimitDragDropOptions(dataObject.Object);

            //------------Assert Results-------------------------
            Assert.IsFalse(dropEnabled);
        }
示例#14
0
        public void ForeachActivityDesignerUtils_LimitDragDropOptions_ModelItemsFormat_WithDecisionAndCount_DropPrevented()
        {
            //------------Setup for test--------------------------
            var activityDesignerUtils = new DropEnabledActivityDesignerUtils();
            var dataObject            = new Mock <IDataObject>();

            dataObject.Setup(o => o.GetFormats()).Returns(new[] { "ModelItemsFormat" });
            var modelItemList = new List <ModelItem> {
                ModelItemUtils.CreateModelItem(new DsfCountRecordsetActivity()), ModelItemUtils.CreateModelItem(new FlowDecision())
            };

            dataObject.Setup(o => o.GetData(It.IsAny <string>())).Returns(modelItemList);
            //------------Execute Test---------------------------
            var dropEnabled = activityDesignerUtils.LimitDragDropOptions(dataObject.Object);

            //------------Assert Results-------------------------
            Assert.IsFalse(dropEnabled);
        }
示例#15
0
 void DropPointOnDragEnter(object sender, DragEventArgs e)
 {
     if (_dropEnabledActivityDesignerUtils != null)
     {
         var dropEnabled = _dropEnabledActivityDesignerUtils.LimitDragDropOptions(e.Data);
         if (!dropEnabled)
         {
             e.Effects = DragDropEffects.None;
             e.Handled = true;
         }
         else
         {
             if (ViewModel.MultipleItemsToSequence(e.Data))
             {
                 e.Effects = DragDropEffects.None;
                 e.Handled = true;
             }
         }
     }
 }
        public void ForeachActivityDesignerUtils_LimitDragDropOptions_WorkflowItemTypeNameFormat_SwitchModelItem_DropPrevented()
        {
            //------------Setup for test--------------------------
            var activityDesignerUtils = new DropEnabledActivityDesignerUtils();
            var mock = new Mock <IShellViewModel>();

            mock.Setup(model => model.ShowPopup(It.IsAny <IPopupMessage>()));
            CustomContainer.Register(mock.Object);
            var dataObject = new Mock <IDataObject>();

            dataObject.Setup(o => o.GetFormats()).Returns(new[] { "WorkflowItemTypeNameFormat" });
            var modelItem = ModelItemUtils.CreateModelItem(new FlowSwitch <string>());

            dataObject.Setup(o => o.GetData(It.IsAny <string>())).Returns(modelItem);
            //------------Execute Test---------------------------
            var dropEnabled = activityDesignerUtils.LimitDragDropOptions(dataObject.Object);

            //------------Assert Results-------------------------
            Assert.IsFalse(dropEnabled);
            mock.VerifyAll();
        }