예제 #1
0
        public static ScriptTaskContext ExeContext(bool debugging = true, ServiceManager services = null)
        {
            ScriptTaskContext taskContext = new ScriptTaskContext();

            RuntimeErrors = new RuntimeErrorCollector();
            taskContext.SetErrorListener(RuntimeErrors.ReportError);
            var logger = new LoggerRoot("", false, "TestRun", "Starting");

            if (debugging)
            {
                logger.IsDebugging = true;
            }
            var taskStatusUpdater           = new Mocks.ExecutionScopeStatusUpdaterMock();
            ILoadedFilesManager loadedFiles = null;
            TaskManager         taskManager = null;

            if (services != null)
            {
                loadedFiles = services.Get <ILoadedFilesManager>();
                taskManager = services.Get <TaskManager>();
            }
            else
            {
                IService service;
                loadedFiles = new LoadedFilesManager(out service);
                taskManager = new TaskManager(out service);
            }
            taskContext.Setup(logger.m_rootLogger, ContextLogOption.Normal, taskStatusUpdater, loadedFiles, taskManager);
            return(taskContext);
        }
예제 #2
0
 private void M_child_Disposed(object sender, EventArgs e)
 {
     if (Object.ReferenceEquals(sender, m_child))
     {
         m_child.Disposed -= M_child_Disposed;
         m_child           = null;
     }
 }
예제 #3
0
 public IExecutionScopeStatusUpdate CreateProgressReporter(string text = "", TimeSpan expectedTime = default(TimeSpan), long progressMax = -1L, Func <long, string> progressFormatter = null)
 {
     if (m_child != null)
     {
         throw new Exception("Child status already active.");
     }
     MiniLogger.Instance.Add("TaskUpdate(" + m_level + ").CreateProgressReporter( " + text + " )");
     m_child                     = new ExecutionScopeStatusUpdaterMock();
     m_child.m_level             = m_level + 1;
     m_child.m_text              = text;
     m_child.m_expectedTime      = expectedTime;
     m_child.m_progressMax       = progressMax;
     m_child.m_progressFormatter = progressFormatter;
     m_child.Disposed           += M_child_Disposed;
     return(m_child);
 }