Esempio n. 1
0
        /// <summary>
        /// This methods re-routes a moved tasks connections and any other connections that it now intersects.
        /// It is called when a task is dragged on the diagram.
        /// It is also called when a new task is dropped from the palette.
        /// In this case there are no existing connections to the task but it may intersect other connections
        /// which will need to be re-routed.
        /// </summary>
        /// <param name="task"></param>
        public void ReRouteTask(TaskObj task)
        {
            var taskConnectors  = Connector.GetConnections(task).ToArray();
            var bounds          = DiagramView.View.RoundOutToGrid(task.Symbol.Shape.Bounds);
            var otherConnectors =
                (from c in Connector.Connectors
                 where !taskConnectors.Contains(c)
                 where c.HitsRectangle(bounds)
                 select c).ToList();

            // Need to unroute these first or they interfere with the router heuristics
            foreach (var connector in taskConnectors)
            {
                connector.UnRoute();
            }

            foreach (var connector in otherConnectors)
            {
                connector.UnRoute();
            }

            var router = new ConnectionRouter(this);

            router.MapConnectors();

            foreach (var connector in taskConnectors)
            {
                router.RouteConnection(connector);
            }

            foreach (var connector in otherConnectors)
            {
                router.RouteConnection(connector);
            }
        }
Esempio n. 2
0
        public FlowObj FindOutflow(TaskObj task, string pinName)
        {
            if (pinName == "Err")
            {
                return(task.FailOutflow);
            }

            return(task.Outflows.Single(f => f.Name == pinName));
        }
Esempio n. 3
0
        /// <summary>
        /// Create a model with a new workflow
        /// </summary>
        public Model()
        {
            Workflow = new WorkflowObj
            {
                Name      = Guid.NewGuid().ToString().Substring(0, 8),
                Version   = "0.0.0.0",
                ObjType   = "workflow",
                TaskList  = "decider",
                Tasks     = new List <TaskObj>(),
                Variables = new VariableCollection()
            };

            // The single, required start task
            var start = new TaskObj
            {
                TaskId          = "start",
                ActivityName    = "start",
                ActivityVersion = "0.0.0.0",
                Outflows        = new [] { new FlowObj {
                                               Name = "Out"
                                           } },
                HiddenProperties = new List <string> {
                    "AsyncSignal", "Inputs", "Outputs", "TaskList", "HeartbeatTimeout", "ScheduleToCloseTimeout", "ScheduleToStartTimeout", "StartToCloseTimeout", "TaskPriority"
                },
                Symbol = new SymbolObj
                {
                    Name      = "start",
                    Label     = "Start",
                    Style     = "circle",
                    LocationX = 100,
                    LocationY = 100
                }
            };

            Workflow.Tasks.Add(start);

            CreateWorkflowInputVariables(Workflow);
        }