Exemple #1
0
        public override bool IsRepresentingSame(TreeNodeTag theTreeNodeTag)
        {
            bool isRepresentingSame = false;

            ScriptFileTag theScriptFileTag = theTreeNodeTag as ScriptFileTag;

            if (theScriptFileTag != null)
            {
                if ((theScriptFileTag._Session == _Session) && (theScriptFileTag._ScriptFileName == _ScriptFileName))
                {
                    isRepresentingSame = true;
                }
            }

            return(isRepresentingSame);
        }
        private void ExecuteDicomScriptInThread(ScriptFileTag theScriptFileTag)
        {
            string theResultsFileName = null;
            Dvtk.Sessions.ScriptSession theScriptSession = (Dvtk.Sessions.ScriptSession)theScriptFileTag._Session;

            // Determine the results file name.
            theResultsFileName = ResultsFile.GetExpandedNameForScriptFile(theScriptSession, theScriptFileTag._ScriptFileName);

            // Start the results gathering.
            theScriptSession.StartResultsGathering(theResultsFileName);

            // Perform the actual execution of the script.
            AsyncCallback theExecuteScriptAsyncCallback = new AsyncCallback(this.ResultsFromExecutingScriptAsynchronously);
            theScriptSession.BeginExecuteScript(theScriptFileTag._ScriptFileName, false, theExecuteScriptAsyncCallback);
        }
 public void ExecuteVisualBasicScriptInThread(ScriptFileTag theScriptFileTag)
 {
     _ScriptThread = new Thread (new ThreadStart (this.ExecuteVisualBasicScript));
     _ScriptThread.Start();
 }
        public void UpdateScriptFileNode(TreeNode theScriptFileTreeNode, Dvtk.Sessions.Session theSession, string theScriptFileName, ArrayList theResultsFiles, bool isExecuting)
        {
            // Set the text on this script file tree node.
            if (isExecuting)
            {
                theScriptFileTreeNode.Text = theScriptFileName + " (executing)";
            }
            else
            {
                theScriptFileTreeNode.Text = theScriptFileName;
            }

            // Set the tag for this script file tree node.
            ScriptFileTag theScriptFileTag = new ScriptFileTag(theSession);
            theScriptFileTag._ScriptFileName = theScriptFileName;

            theScriptFileTreeNode.Tag = theScriptFileTag;

            // Remove the old tree nodes that may be present under this script file tree node.
            theScriptFileTreeNode.Nodes.Clear();

            if (!isExecuting)
            {
                // For all result files that belong to this script file, create a sub node.
                // The theResultsFiles object contains all results files that have not yet been added to
                // already processed script file nodes.

                ArrayList theResultsFilesForThisScriptFile = ResultsFile.GetNamesForScriptFile(theScriptFileName, theResultsFiles);
                theResultsFiles = ResultsFile.FilterOutResultsFileNames(theResultsFiles, theResultsFilesForThisScriptFile);

                foreach (string theResultsFile in theResultsFilesForThisScriptFile)
                {
                    TreeNode theResultsFileTreeNode = new TreeNode();
                    theScriptFileTreeNode.Nodes.Add(theResultsFileTreeNode);

                    UpdateResultsFileNode(theResultsFileTreeNode, theSession, theResultsFile);
                }
            }
        }