diff options
Diffstat (limited to 'product/Boot/boot/WindowsFormsApplication.cs')
| -rw-r--r-- | product/Boot/boot/WindowsFormsApplication.cs | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/product/Boot/boot/WindowsFormsApplication.cs b/product/Boot/boot/WindowsFormsApplication.cs index 64abd76..d47a5f1 100644 --- a/product/Boot/boot/WindowsFormsApplication.cs +++ b/product/Boot/boot/WindowsFormsApplication.cs @@ -29,23 +29,21 @@ namespace MoMoney.boot public void run() { - var stopwatch = new Stopwatch(); - stopwatch.Start(); - Func<ISplashScreenPresenter> presenter = () => new SplashScreenPresenter(); - presenter = presenter.memorize(); - - var startup_screen = new display_the_splash_screen(presenter).on_a_background_thread(); + using (new LogTime()) + { + Func<ISplashScreenPresenter> presenter = () => new SplashScreenPresenter(); + presenter = presenter.memorize(); - AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); - hookup - .the<global_error_handling>() - .then(startup_screen) - .then<wire_up_the_container>() - .then(new start_the_application(startup_screen)) - .run(); + var startup_screen = new display_the_splash_screen(presenter).on_a_background_thread(); - stopwatch.Stop(); - this.log().debug("application startup took: {0}", stopwatch.Elapsed); + AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); + hookup + .the<global_error_handling>() + .then(startup_screen) + .then<wire_up_the_container>() + .then(new start_the_application(startup_screen)) + .run(); + } start(); } @@ -63,6 +61,23 @@ namespace MoMoney.boot } } + public class LogTime : IDisposable + { + Stopwatch stopwatch; + + public LogTime() + { + stopwatch = new Stopwatch(); + stopwatch.Start(); + } + + public void Dispose() + { + stopwatch.Stop(); + this.log().debug("application startup took: {0}", stopwatch.Elapsed); + } + } + public class ApplicationContainer : Container { readonly IServiceContainer container; |
