예제 #1
0
        public void UpdateScriptSessionNode(TreeNode scriptSessionTreeNode, ScriptSession scriptSession )
        {
            bool isSessionExecuting = scriptSession.IsExecute;
            bool isSessionExecutingInOtherSessionTreeView = (isSessionExecuting && (scriptSession != GetExecutingSession()));
            // Set the tag for this session tree node.

            scriptSessionTreeNode.Tag = scriptSession;
            // Remove the old tree nodes that may be present under this session tree node.
            scriptSessionTreeNode.Nodes.Clear();
            scriptSession.CreateScriptFiles();
            // If this session is executing...
            if (isSessionExecutingInOtherSessionTreeView) {
                // Do nothing.
            }
            else if (!isSessionExecuting) {

                // Create a sub-node for each script file contained in this session.
                if (scriptSession.ScriptFiles == null ){

                }
                else {
                    foreach(Script script in scriptSession.ScriptFiles) {
                        TreeNode scriptNode = new TreeNode();
                        scriptSessionTreeNode.Nodes.Add(scriptNode);
                        UpdateScriptFileNode(scriptNode,script);
                    }
                }
            }
            else {
                // Sanity check, pre-condition of this method is not fullfilled.
                Debug.Assert(false);
            }
        }
예제 #2
0
        public void UpdateScriptSessionNode(TreeNode scriptSessionTreeNode, ScriptSession scriptSession, ref bool isEmpty )
        {
            bool isSessionExecuting = scriptSession.IsExecute;
            bool isSessionExecutingInOtherSessionTreeView = (isSessionExecuting && (scriptSession != GetExecutingSession()));
            IList scriptFilesTemp = new ArrayList();

            // Set the tag for this session tree node.
            scriptSessionTreeNode.Tag = scriptSession;

            // Remove the old tree nodes that may be present under this session tree node.
            scriptSessionTreeNode.Nodes.Clear();
            scriptSession.CreateScriptFiles();

            // If this session is executing...
            if (isSessionExecutingInOtherSessionTreeView)
            {
                // Do nothing.
            }
            else if (!isSessionExecuting)
            {
                // Create a sub-node for each script file contained in this session.
                if (scriptSession.ScriptFiles != null)
                {
                    // Determine the visible scripts.
                    ArrayList visibleScripts = GetVisibleScripts(scriptSession);
                    isEmpty = (visibleScripts.Count == 0);
                    foreach (string scriptName in visibleScripts)
                    {
                        foreach (Script script in scriptSession.ScriptFiles)
                        {
                            if (scriptName == script.ScriptFileName)
                            {
                                scriptFilesTemp.Add(script);
                            }
                        }
                    }

                    foreach (Script script in scriptFilesTemp)
                    {
                        TreeNode scriptNode = new TreeNode();
                        scriptSessionTreeNode.Nodes.Add(scriptNode);
                        UpdateScriptFileNode(scriptNode, script);
                    }
                }
                else
                {
                    TreeNode scriptNode = new TreeNode();
                    scriptNode.Text = "Warning: Session doesn't contain any scripts";
                    scriptSessionTreeNode.Nodes.Add(scriptNode);
                }
            }
            else
            {
                // Sanity check, pre-condition of this method is not fullfilled.
                Debug.Assert(false);
            }
        }