void AllowDrag(DragEventArgs e) { if (_dropEnabledActivityDesignerUtils != null) { var dropEnabled = _dropEnabledActivityDesignerUtils.LimitDragDropOptions(e.Data); if (!dropEnabled) { e.Effects = DragDropEffects.None; e.Handled = true; } } }
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; } }
void DropPointOnDragEnter(object sender, DragEventArgs e) { if (_dropEnabledActivityDesignerUtils != null) { var dropEnabled = _dropEnabledActivityDesignerUtils.LimitDragDropOptions(e.Data); if (!dropEnabled) { e.Effects = DragDropEffects.None; e.Handled = true; } } }
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); }
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); }
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); }
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); }
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; } } }
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; }
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; } }
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); }
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); }
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); }
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(); }