Пример #1
0
        /// <summary>
        /// Compiles the code of the single decision node or loop scope node. It handles DecisionNode and LoopScopeNode slightly differently.
        /// Method.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="experiment">The experiment.</param>
        /// <param name="workspaceTypesDirectories">The workspace types directories.</param>
        /// <param name="loggerNameRoot">The logger name root.</param>
        public static void CompileDecision(ExperimentNode node, IExperiment experiment, List <string> workspaceTypesDirectories, LoggerNameRoot loggerNameRoot)
        {
            ExperimentDecisionNode decisionNode = node as ExperimentDecisionNode;

            if (decisionNode != null)
            {
                Dictionary <string, string> successorNodeLabelIdLookup = PrepareSuccessorNodesLabelIdLookup(node, experiment);
                CompileDecisionInternal(decisionNode, experiment, workspaceTypesDirectories, loggerNameRoot, successorNodeLabelIdLookup);
            }
            else
            {
                LoopScopeNode loopScopeNode = node as LoopScopeNode;
                if (loopScopeNode != null)
                {
                    //loop scope does not need successor nodes lookups, so pass in empty dictionary
                    Dictionary <string, string> successorNodeLabelIdLookup = new Dictionary <string, string>();
                    CompileDecisionInternal(loopScopeNode, experiment, workspaceTypesDirectories, loggerNameRoot, successorNodeLabelIdLookup);
                }
            }
        }
        /// <summary>
        /// When overridden in a derived class, is invoked whenever application code or internal processes call <see cref="M:System.Windows.FrameworkElement.ApplyTemplate"/>.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            var vertexControl = (GraphSharp.Controls.VertexControl)DataContext;

            m_exitScopeNode = (ExperimentEndNode)vertexControl.Vertex;

            //listen to property changed of the parent scope node, and update exit node x and y, if scope size is changing.
            LoopScopeNodeControl scope = this.GetParent <LoopScopeNodeControl>(null);

            //find node label border - needed border height to adjust node move inside the canvas
            Border labelBorder = (Border)scope.Template.FindName("labelBorder", scope);

            m_labelHeight = labelBorder.ActualHeight;

            m_scopeNode = (LoopScopeNode)scope.VertexControl.Vertex;

            //listen to scope node size change and exit node position changes
            m_scopeNode.DataWithSize.PropertyChanged += ScopeNodeData_PropertyChanged;

            //intially move node to the border
            MoveNodeToCenterOfBottomBorder();
        }