private void Run(string[] args) { var banner = new StringBuilder(); banner.AppendLine(@" ______ __ __ "); banner.AppendLine(@"| __ \.-----.-----.| |_.-----.| |_.----.---.-.-----.-----.-----.----."); banner.AppendLine(@"| __ <| _ | _ || _|__ --|| _| _| _ | _ | _ | -__| _|"); banner.AppendLine(@"|______/|_____|_____||____|_____||____|__| |___._| __| __|_____|__| "); banner.AppendLine(@" |__| |__| "); banner.AppendLine(@" "); var logging = new LoggingOrchestrator(); logging.InitializeLogging <ConsoleAndFileLogger>("Main", banner.ToString()); var app = new App { ShutdownMode = ShutdownMode.OnLastWindowClose }; GlobalExceptionHandlers.WireUp(); var environment = new EnvironmentFacade(Assembly.GetExecutingAssembly()); var appSettings = ConfigurationParser.Parse(args, ConfigurationManager.AppSettings); logging.LogUsefulInformation(environment, appSettings); app.Exit += (s, e) => app.Log().Info($"{environment.GetProductName()} is exiting"); app.InitializeComponent(); var shell = new ShellView { ViewModel = new ShellViewModel(new ShellViewModelValidator()) }; shell.Show(); app.Run(); this.Log().Debug($"{environment.GetProductName()} has exited."); }
public void Start(string[] commandLineArgs) { Log4NetConfig.Setup(); var banner = new StringBuilder(); banner.AppendLine(@" ______ __ __ "); banner.AppendLine(@"| __ \.-----.-----.| |_.-----.| |_.----.---.-.-----.-----.-----.----."); banner.AppendLine(@"| __ <| _ | _ || _|__ --|| _| _| _ | _ | _ | -__| _|"); banner.AppendLine(@"|______/|_____|_____||____|_____||____|__| |___._| __| __|_____|__| "); banner.AppendLine(@" |__| |__| "); banner.AppendLine(@" "); var logging = new LoggingOrchestrator(); logging.InitializeLogging <Log4NetLog>("Main", banner.ToString()); GlobalExceptionHandlers.WireUp(); System.Console.OutputEncoding = Encoding.UTF8; var environment = new EnvironmentFacade(Assembly.GetExecutingAssembly()); var appSettings = ConfigurationParser.Parse(commandLineArgs, ConfigurationManager.AppSettings); logging.LogUsefulInformation(environment, appSettings); var container = InitializeContainer(appSettings); _disposableBag.Add(container); this.Log().Debug($"Finished bootstrapping {environment.GetProductName()}."); // Kick off long running services var orchestrator = container.Resolve <LongRunningServiceOrchestrator>(); orchestrator.StartLongRunningServices() .ContinueWith(_ => { this.Log().Info($"All long running services are started."); // This code will listen to console key presses and execute the code // associated with it if (Environment.UserInteractive) { this.Log().Debug($"Interactive console mode detected."); var commandProcessor = container.Resolve <ConsoleCommandOrchestrator>(); commandProcessor.StartUp(); } }); }