private void AddBlankComponent(DataFlowComponentVisualisation.Role role) { DataFlowComponentVisualisation toAdd = new DataFlowComponentVisualisation(role, null, component_shouldAllowDrop); toAdd.DragDrop += component_DragDrop; flpPipelineDiagram.Controls.Add(toAdd); }
public AdvertisedPipelineComponentTypeUnderContext(Type componentType, IPipelineUseCase useCase) { _componentType = componentType; _role = DataFlowComponentVisualisation.GetRoleFor(componentType); var context = useCase.GetContext(); _allowableUnderContext = context.IsAllowable(componentType, out _allowableReason); Type[] initializationTypes; var initializationObjects = useCase.GetInitializationObjects(); //it is permitted to specify only Types as initialization objects if it is design time and the user hasn't picked any objects to execute the use case under if (useCase.IsDesignTime && initializationObjects.All(t => t is Type)) { initializationTypes = initializationObjects.Cast <Type>().ToArray(); } else { initializationTypes = useCase.GetInitializationObjects().Select(o => o.GetType()).ToArray(); } foreach (var requiredInputType in context.GetIPipelineRequirementsForType(componentType)) { //if there are no initialization objects that are instances of an IPipelineRequirement<T> then we cannot satisfy the components pipeline requirements (e.g. a component DelimitedFlatFileDataFlowSource requires a FlatFileToLoad but pipeline is trying to load from a database reference) if (!initializationTypes.Any(available => requiredInputType == available || requiredInputType.IsAssignableFrom(available))) { unmetRequirements.Add(requiredInputType); } } }
private DragDropEffects component_shouldAllowDrop(DragEventArgs arg, DataFlowComponentVisualisation sender) { var obj = GetAdvertisedObjectFromDragOperation(arg); //if they are dragging a new component if (obj != null) { //of the correct role and the source/destination is empty if (sender.Value == null && obj.GetRole() == sender.GetRole()) { return(DragDropEffects.Move); } } return(DragDropEffects.None); }
private void AddExplicit(object value) { var role = DataFlowComponentVisualisation.GetRoleFor(value.GetType()); var component = new DataFlowComponentVisualisation(role, value, null); flpPipelineDiagram.Controls.Add(component);//add the explicit component component.IsLocked = true; try { if (!_useCase.IsDesignTime) { _useCase.GetContext().PreInitializeGeneric(new ThrowImmediatelyDataLoadEventListener(), component.Value, _useCase.GetInitializationObjects().ToArray()); } } catch (Exception e) { ExceptionViewer.Show("PreInitialize failed on Explicit (locked component) " + component.Value.GetType().Name, e); } }