예제 #1
0
 public ControllerImpl(TaskRunWindow window)
 {
     Window               = window;
     Logger               = new Logger(FileEndpoint.CreateForLogFile(), this);
     Logger.OpenContext  += PushContext;
     Logger.CloseContext += PopContext;
 }
예제 #2
0
        public static void Run <TTask, TConfig>(RunParams runParams)
            where TTask : TaskBase <TTask, TConfig>, new()
            where TConfig : TaskConfigBase <TTask, TConfig>, new()
        {
            var config = Phase.Run("Create config", () => CreateConfig <TConfig>(runParams.ConfigFullPath));

            if (runParams.ShowUi)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new TaskToolWindow(runParams, typeof(TConfig), config, (cfg, ctrl) => RunInternal(ctrl, (TConfig)cfg)));
            }
            else
            {
                using (var logger = new Logger(new ConsoleEndpoint(), FileEndpoint.CreateForLogFile()))
                    RunInternal(new ControllerImpl(logger), config);
            }
        }