Commit 7e14c2d

mokhan <mokhan@ce5e1baf-6525-42e4-a1b2-857ea38da20a>
2009-03-08 22:36:22
refactoring everything... yikes!
git-svn-id: https://svn.xp-dev.com/svn/mokhan-mo.money@62 ce5e1baf-6525-42e4-a1b2-857ea38da20a
1 parent 7f73942
trunk/product/MyMoney/Domain/Core/registry_extensions.cs
@@ -1,13 +0,0 @@
-using System.Collections.Generic;
-using MoMoney.Utility.Extensions;
-
-namespace MoMoney.Domain.Core
-{
-    public static class registry_extensions
-    {
-        public static IEnumerable<T> sort_all_using<T>(this IRegistry<T> registry, IComparer<T> comparer)
-        {
-            return registry.all().sorted_using(comparer);
-        }
-    }
-}
\ No newline at end of file
trunk/product/MyMoney/Infrastructure/eventing/EventAggregator.cs
@@ -1,6 +1,7 @@
 using System.Collections.Generic;
 using System.Linq;
 using Castle.Core;
+using MoMoney.Infrastructure.Extensions;
 using MoMoney.Utility.Extensions;
 
 namespace MoMoney.Infrastructure.eventing
@@ -15,7 +16,7 @@ namespace MoMoney.Infrastructure.eventing
     [Singleton]
     public class EventAggregator : IEventAggregator
     {
-        private readonly IDictionary<string, HashSet<object>> subscribers;
+        readonly IDictionary<string, HashSet<object>> subscribers;
 
         public EventAggregator()
         {
@@ -24,7 +25,8 @@ namespace MoMoney.Infrastructure.eventing
 
         public void subscribe_to<Event>(IEventSubscriber<Event> subscriber) where Event : IEvent
         {
-            if (!get_list_for<Event>().Contains(subscriber)) {
+            if (!get_list_for<Event>().Contains(subscriber))
+            {
                 get_list_for<Event>().Add(subscriber);
             }
         }
@@ -33,7 +35,12 @@ namespace MoMoney.Infrastructure.eventing
         {
             get_list_for<Event>()
                 .Select(x => x.downcast_to<IEventSubscriber<Event>>())
-                .each(x => x.notify(the_event_to_broadcast));
+                .each(x =>
+                          {
+                              this.log().debug("publishing event {0} to {1}", typeof (Event), x.GetType().FullName);
+                              x.notify(the_event_to_broadcast);
+                          }
+                );
         }
 
         public void publish<Event>() where Event : IEvent, new()
@@ -41,9 +48,10 @@ namespace MoMoney.Infrastructure.eventing
             publish(new Event());
         }
 
-        private HashSet<object> get_list_for<Event>()
+        HashSet<object> get_list_for<Event>()
         {
-            if (!subscribers.ContainsKey(typeof (Event).FullName)) {
+            if (!subscribers.ContainsKey(typeof (Event).FullName))
+            {
                 subscribers.Add(typeof (Event).FullName, new HashSet<object>());
             }
             return subscribers[typeof (Event).FullName];
trunk/product/MyMoney/Infrastructure/registries/default_registry.cs
@@ -1,6 +1,6 @@
 using System.Collections.Generic;
-using MoMoney.Domain.Core;
 using MoMoney.Infrastructure.Container;
+using MoMoney.Utility.Core;
 
 namespace MoMoney.Infrastructure.registries
 {
trunk/product/MyMoney/Infrastructure/registries/default_registry_specs.cs
@@ -1,10 +1,10 @@
 using System.Collections.Generic;
 using jpboodhoo.bdd.contexts;
-using MoMoney.Domain.Core;
 using MoMoney.Infrastructure.Container;
 using MoMoney.Testing.MetaData;
 using MoMoney.Testing.spechelpers.contexts;
 using MoMoney.Testing.spechelpers.core;
+using MoMoney.Utility.Core;
 
 namespace MoMoney.Infrastructure.registries
 {
trunk/product/MyMoney/Infrastructure/Threading/BackgroundThreadFactory.cs
@@ -26,7 +26,7 @@ namespace MoMoney.Infrastructure.Threading
 
         public IBackgroundThread create_for(Action action)
         {
-            return new BackgroundThread(new command(action));
+            return new BackgroundThread(new DisposableCommand(action));
         }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Presentation/Context/the_application_context.cs
@@ -10,7 +10,7 @@ namespace MoMoney.Presentation.Context
     {
         public the_application_context(IShell shell_view,
                                        IExitCommand exit_command,
-                                       ILoadApplicationShellCommand command)
+                                       ILoadPresentationModulesCommand command)
         {
             shell_view.downcast_to<Form>().Closed += ((sender, args) => exit_command.run());
             MainForm = shell_view.downcast_to<Form>();
trunk/product/MyMoney/Presentation/Context/the_application_context_specs.cs
@@ -22,13 +22,13 @@ namespace MoMoney.Presentation.Context
         context c = () =>
                         {
                             shell_view = dependency<ApplicationShell>();
-                            exit_command = an<IExitCommand>();
-                            load_application = an<ILoadApplicationShellCommand>();
+                            exit_command = the_dependency<IExitCommand>();
+                            load_application = the_dependency<ILoadPresentationModulesCommand>();
                         };
 
         static protected ApplicationShell shell_view;
         static protected IExitCommand exit_command;
-        static protected ILoadApplicationShellCommand load_application;
+        static protected ILoadPresentationModulesCommand load_application;
     }
 
     public class when_starting_the_application : behaves_like_an_application_context
trunk/product/MyMoney/Presentation/Core/application_controller.cs → trunk/product/MyMoney/Presentation/Core/ApplicationController.cs
@@ -9,12 +9,12 @@ namespace MoMoney.Presentation.Core
         void run<Presenter>() where Presenter : IPresenter;
     }
 
-    public class application_controller : IApplicationController
+    public class ApplicationController : IApplicationController
     {
-        private readonly IPresenterRegistry registered_presenters;
-        private readonly IShell shell;
+        readonly IPresenterRegistry registered_presenters;
+        readonly IShell shell;
 
-        public application_controller(IPresenterRegistry registered_presenters, IShell shell)
+        public ApplicationController(IPresenterRegistry registered_presenters, IShell shell)
         {
             this.registered_presenters = registered_presenters;
             this.shell = shell;
@@ -22,7 +22,7 @@ namespace MoMoney.Presentation.Core
 
         public void run<Presenter>() where Presenter : IPresenter
         {
-            run(registered_presenters.find_an_implementation_of<Presenter>());
+            run(registered_presenters.find_an_implementation_of<IPresenter, Presenter>());
         }
 
         public void run(IPresenter presenter)
trunk/product/MyMoney/Presentation/Core/application_controller_specs.cs → trunk/product/MyMoney/Presentation/Core/ApplicationControllerSpecs.cs
@@ -7,8 +7,9 @@ using MoMoney.Testing.spechelpers.core;
 
 namespace MoMoney.Presentation.Core
 {
-    [Concern(typeof (application_controller))]
-    public abstract class behaves_like_an_application_controller : concerns_for<IApplicationController, application_controller>
+    [Concern(typeof (ApplicationController))]
+    public abstract class behaves_like_an_application_controller :
+        concerns_for<IApplicationController, ApplicationController>
     {
         context c = () =>
                         {
@@ -16,8 +17,8 @@ namespace MoMoney.Presentation.Core
                             shell = the_dependency<IShell>();
                         };
 
-        static protected IShell shell;
-        static protected IPresenterRegistry presenter_registry;
+        protected static IShell shell;
+        protected static IPresenterRegistry presenter_registry;
     }
 
     public class when_the_application_controller_is_asked_to_run_a_presenter : behaves_like_an_application_controller
trunk/product/MyMoney/Presentation/Core/could_not_find_presenter.cs
@@ -1,13 +0,0 @@
-using System;
-using MoMoney.Utility.Extensions;
-
-namespace MoMoney.Presentation.Core
-{
-    public class could_not_find_presenter<T> : Exception
-    {
-        public could_not_find_presenter(Exception e)
-            : base("Could Not Find an implementation of".formatted_using(typeof (T)), e)
-        {
-        }
-    }
-}
\ No newline at end of file
trunk/product/MyMoney/Presentation/Core/IPresentationModule.cs
@@ -1,6 +1,8 @@
+using MoMoney.Utility.Core;
+
 namespace MoMoney.Presentation.Core
 {
-    public interface IPresentationModule : IPresenter
+    public interface IPresentationModule : ICommand
     {
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Presentation/Core/presenter_registry_extensions.cs
@@ -1,36 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using MoMoney.Domain.Core;
-using MoMoney.Utility.Extensions;
-
-namespace MoMoney.Presentation.Core
-{
-    public static class presenter_registry_extensions
-    {
-        public static IEnumerable<Presenter> all_implementations_of<Presenter>(this IRegistry<IPresenter> repository)
-            where Presenter : IPresenter
-        {
-            return repository
-                .all()
-                .Where(p => p.is_an_implementation_of<Presenter>())
-                .Select(p => p.downcast_to<Presenter>());
-        }
-
-        public static Presenter find_an_implementation_of<Presenter>(this IRegistry<IPresenter> registry)
-            where Presenter : IPresenter
-        {
-            try
-            {
-                return registry
-                    .all()
-                    .Single(p => p.is_an_implementation_of<Presenter>())
-                    .downcast_to<Presenter>();
-            }
-            catch (Exception exception)
-            {
-                throw new could_not_find_presenter<Presenter>(exception);
-            }
-        }
-    }
-}
\ No newline at end of file
trunk/product/MyMoney/Presentation/Core/PresenterRegistry.cs
@@ -1,5 +1,5 @@
 using System.Collections.Generic;
-using MoMoney.Domain.Core;
+using MoMoney.Utility.Core;
 
 namespace MoMoney.Presentation.Core
 {
trunk/product/MyMoney/Presentation/Model/Menu/File/Commands/CloseProjectCommand.cs
@@ -1,5 +1,4 @@
 using MoMoney.Presentation.Model.Projects;
-using MoMoney.Presentation.Views.Shell;
 using MoMoney.Utility.Core;
 
 namespace MoMoney.Presentation.Model.Menu.File.Commands
@@ -10,13 +9,11 @@ namespace MoMoney.Presentation.Model.Menu.File.Commands
 
     public class CloseProjectCommand : ICloseCommand
     {
-        readonly IShell shell;
         readonly IProject project;
         readonly ISaveChangesCommand command;
 
-        public CloseProjectCommand(IShell shell, IProject project, ISaveChangesCommand command)
+        public CloseProjectCommand(IProject project, ISaveChangesCommand command)
         {
-            this.shell = shell;
             this.command = command;
             this.project = project;
         }
@@ -29,13 +26,11 @@ namespace MoMoney.Presentation.Model.Menu.File.Commands
         public void saved()
         {
             project.close();
-            shell.close_all_windows();
         }
 
         public void not_saved()
         {
             project.close();
-            shell.close_all_windows();
         }
 
         public void cancelled()
trunk/product/MyMoney/Presentation/Model/Menu/File/Commands/new_command_specs.cs
@@ -10,20 +10,15 @@ namespace MoMoney.Presentation.Model.Menu.File.Commands
     [Concern(typeof (NewCommand))]
     public abstract class behaves_like_new_command : concerns_for<INewCommand, NewCommand>
     {
-        //public override INewCommand create_sut()
-        //{
-        //    return new NewCommand(current_project, command, save_changes_command);
-        //}
-
         context c = () =>
                         {
                             current_project = the_dependency<IProject>();
-                            command = the_dependency<ILoadApplicationShellCommand>();
+                            command = the_dependency<ILoadPresentationModulesCommand>();
                             save_changes_command = the_dependency<ISaveChangesCommand>();
                         };
 
         protected static IProject current_project;
-        protected static ILoadApplicationShellCommand command;
+        protected static ILoadPresentationModulesCommand command;
         protected static ISaveChangesCommand save_changes_command;
     }
 
trunk/product/MyMoney/Presentation/Model/Menu/File/Commands/NewCommand.cs
@@ -1,5 +1,4 @@
 using MoMoney.Presentation.Model.Projects;
-using MoMoney.Presentation.Presenters.Commands;
 using MoMoney.Utility.Core;
 
 namespace MoMoney.Presentation.Model.Menu.File.Commands
@@ -11,14 +10,12 @@ namespace MoMoney.Presentation.Model.Menu.File.Commands
     public class NewCommand : INewCommand
     {
         readonly IProject current_project;
-        readonly ILoadApplicationShellCommand command;
         readonly ISaveChangesCommand save_changes_command;
 
-        public NewCommand(IProject current_project, ILoadApplicationShellCommand command, ISaveChangesCommand save_changes_command)
+        public NewCommand(IProject current_project, ISaveChangesCommand save_changes_command)
         {
             this.current_project = current_project;
             this.save_changes_command = save_changes_command;
-            this.command = command;
         }
 
         public void run()
@@ -29,13 +26,11 @@ namespace MoMoney.Presentation.Model.Menu.File.Commands
         public void saved()
         {
             current_project.start_a_new_project();
-            command.run();
         }
 
         public void not_saved()
         {
             current_project.start_a_new_project();
-            command.run();
         }
 
         public void cancelled()
trunk/product/MyMoney/Presentation/Model/Menu/File/Commands/OpenCommand.cs
@@ -1,5 +1,4 @@
 using MoMoney.Presentation.Model.Projects;
-using MoMoney.Presentation.Presenters.Commands;
 using MoMoney.Presentation.Views.dialogs;
 using MoMoney.Utility.Core;
 
@@ -13,15 +12,12 @@ namespace MoMoney.Presentation.Model.Menu.File.Commands
     {
         readonly ISelectFileToOpenDialog view;
         readonly IProject project;
-        readonly ILoadApplicationShellCommand command;
         readonly ISaveChangesCommand save_changes_command;
 
-        public OpenCommand(ISelectFileToOpenDialog view, IProject project, ILoadApplicationShellCommand command,
-                            ISaveChangesCommand save_changes_command)
+        public OpenCommand(ISelectFileToOpenDialog view, IProject project, ISaveChangesCommand save_changes_command)
         {
             this.view = view;
             this.save_changes_command = save_changes_command;
-            this.command = command;
             this.project = project;
         }
 
@@ -47,7 +43,6 @@ namespace MoMoney.Presentation.Model.Menu.File.Commands
         void open_project()
         {
             project.open(view.tell_me_the_path_to_the_file());
-            command.run();
         }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Presentation/Model/Menu/File/Commands/OpenCommandSpecs.cs
@@ -1,6 +1,5 @@
 using jpboodhoo.bdd.contexts;
 using MoMoney.Presentation.Model.Projects;
-using MoMoney.Presentation.Presenters.Commands;
 using MoMoney.Presentation.Views.dialogs;
 using MoMoney.Testing.MetaData;
 using MoMoney.Testing.spechelpers.contexts;
@@ -11,22 +10,17 @@ namespace MoMoney.Presentation.Model.Menu.File.Commands
     [Concern(typeof (OpenCommand))]
     public abstract class behaves_like_command_to_open_a_project : concerns_for<IOpenCommand, OpenCommand>
     {
-        public override IOpenCommand create_sut()
-        {
-            return new OpenCommand(view, project, command, save_changes_command);
-        }
-
         context c = () =>
                         {
                             view = the_dependency<ISelectFileToOpenDialog>();
-                            command = the_dependency<ILoadApplicationShellCommand>();
+                            //command = the_dependency<ILoadPresentationModulesCommand>();
                             project = the_dependency<IProject>();
                             save_changes_command = the_dependency<ISaveChangesCommand>();
                         };
 
         protected static IProject project;
         protected static ISelectFileToOpenDialog view;
-        protected static ILoadApplicationShellCommand command;
+        //protected static ILoadPresentationModulesCommand command;
         protected static ISaveChangesCommand save_changes_command;
     }
 
@@ -44,7 +38,7 @@ namespace MoMoney.Presentation.Model.Menu.File.Commands
     {
         it should_open_the_project_at_the_file_path_specified = () => project.was_told_to(x => x.open(file_path));
 
-        it will_re_load_the_application_shell = () => command.was_told_to(x => x.run());
+        //it will_re_load_the_application_shell = () => command.was_told_to(x => x.run());
 
         context c = () =>
                         {
@@ -54,7 +48,7 @@ namespace MoMoney.Presentation.Model.Menu.File.Commands
 
         because b = () => sut.saved();
 
-        static Projects.ApplicationFile file_path;
+        static ApplicationFile file_path;
     }
 
     public class when_opening_a_project_after_declining_to_save_the_previous_project :
@@ -62,7 +56,7 @@ namespace MoMoney.Presentation.Model.Menu.File.Commands
     {
         it should_open_the_project_at_the_file_path_specified = () => project.was_told_to(x => x.open(file_path));
 
-        it will_re_load_the_application_shell = () => command.was_told_to(x => x.run());
+        //it will_re_load_the_application_shell = () => command.was_told_to(x => x.run());
 
         context c = () =>
                         {
@@ -72,7 +66,7 @@ namespace MoMoney.Presentation.Model.Menu.File.Commands
 
         because b = () => sut.not_saved();
 
-        static Projects.ApplicationFile file_path;
+        static ApplicationFile file_path;
     }
 
     public class
@@ -82,7 +76,7 @@ namespace MoMoney.Presentation.Model.Menu.File.Commands
         it should_not_open_the_project_at_the_file_path_specified =
             () => project.should_not_have_been_asked_to(x => x.open(file_path));
 
-        it will_not_re_load_the_application_shell = () => command.should_not_have_been_asked_to(x => x.run());
+        //it will_not_re_load_the_application_shell = () => command.should_not_have_been_asked_to(x => x.run());
 
         context c = () =>
                         {
@@ -92,6 +86,6 @@ namespace MoMoney.Presentation.Model.Menu.File.Commands
 
         because b = () => sut.cancelled();
 
-        static Projects.ApplicationFile file_path;
+        static ApplicationFile file_path;
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Presentation/Model/Menu/File/FileMenu.cs
@@ -42,7 +42,7 @@ namespace MoMoney.Presentation.Model.Menu.File
                 .named("&Save")
                 .that_executes<ISaveCommand>()
                 .represented_by(ApplicationIcons.SaveProject)
-                .can_be_clicked_when(() => project.has_unsaved_changes())
+                //.can_be_clicked_when(() => project.has_unsaved_changes())
                 .can_be_accessed_with(shortcut_keys.control.and(shortcut_keys.S))
                 .build();
 
trunk/product/MyMoney/Presentation/Model/Menu/SubMenuRegistry.cs
@@ -1,8 +1,8 @@
 using System.Collections.Generic;
-using MoMoney.Domain.Core;
 using MoMoney.Presentation.Model.Menu.File;
 using MoMoney.Presentation.Model.Menu.Help;
 using MoMoney.Presentation.Model.Menu.window;
+using MoMoney.Utility.Core;
 
 namespace MoMoney.Presentation.Model.Menu
 {
trunk/product/MyMoney/Presentation/Model/Projects/current_project.cs → trunk/product/MyMoney/Presentation/Model/Projects/CurrentProject.cs
@@ -21,7 +21,7 @@ namespace MoMoney.Presentation.Model.Projects
     }
 
     [Singleton]
-    public class current_project : IProject
+    public class CurrentProject : IProject
     {
         readonly IDatabaseConfiguration configuration;
         readonly IEventAggregator broker;
@@ -29,7 +29,7 @@ namespace MoMoney.Presentation.Model.Projects
         bool is_project_open = false;
         bool changes_to_save = false;
 
-        public current_project(IDatabaseConfiguration configuration, IEventAggregator broker)
+        public CurrentProject(IDatabaseConfiguration configuration, IEventAggregator broker)
         {
             this.broker = broker;
             this.configuration = configuration;
trunk/product/MyMoney/Presentation/Model/Projects/current_project_specs.cs → trunk/product/MyMoney/Presentation/Model/Projects/CurrentProjectSpecs.cs
@@ -10,12 +10,12 @@ using MoMoney.Testing.spechelpers.core;
 
 namespace MoMoney.Presentation.Model.Projects
 {
-    [Concern(typeof (current_project))]
-    public abstract class behaves_like_a_project : concerns_for<IProject, current_project>
+    [Concern(typeof (CurrentProject))]
+    public abstract class behaves_like_a_project : concerns_for<IProject, CurrentProject>
     {
         public override IProject create_sut()
         {
-            return new current_project(configuration, broker);
+            return new CurrentProject(configuration, broker);
         }
 
         context c = () =>
trunk/product/MyMoney/Presentation/Presenters/Commands/LoadApplicationShell.cs
@@ -1,32 +0,0 @@
-using MoMoney.Presentation.Core;
-using MoMoney.Presentation.Views.Shell;
-using MoMoney.Utility.Core;
-using MoMoney.Utility.Extensions;
-
-namespace MoMoney.Presentation.Presenters.Commands
-{
-    public interface ILoadApplicationShellCommand : ICommand
-    {
-    }
-
-    public class LoadApplicationShell : ILoadApplicationShellCommand
-    {
-        readonly IShell shell;
-        readonly IPresenterRegistry registry;
-        readonly IApplicationController controller;
-
-        public LoadApplicationShell(IPresenterRegistry registry, IApplicationController controller, IShell shell)
-        {
-            this.registry = registry;
-            this.shell = shell;
-            this.controller = controller;
-        }
-
-        public void run()
-        {
-            shell.clear_menu_items();
-            shell.close_all_windows();
-            registry.all_implementations_of<IPresentationModule>().each(x => controller.run(x));
-        }
-    }
-}
\ No newline at end of file
trunk/product/MyMoney/Presentation/Presenters/Commands/LoadPresentationModulesCommand.cs
@@ -0,0 +1,25 @@
+using MoMoney.Presentation.Core;
+using MoMoney.Utility.Core;
+using MoMoney.Utility.Extensions;
+
+namespace MoMoney.Presentation.Presenters.Commands
+{
+    public interface ILoadPresentationModulesCommand : ICommand
+    {
+    }
+
+    public class LoadPresentationModulesCommand : ILoadPresentationModulesCommand
+    {
+        readonly IRegistry<IPresentationModule> registry;
+
+        public LoadPresentationModulesCommand(IRegistry<IPresentationModule> registry)
+        {
+            this.registry = registry;
+        }
+
+        public void run()
+        {
+            registry.all().each(x => x.run());
+        }
+    }
+}
\ No newline at end of file
trunk/product/MyMoney/Presentation/Presenters/Commands/LoadPresentationModulesCommandSpecs.cs
@@ -0,0 +1,27 @@
+using jpboodhoo.bdd.contexts;
+using MoMoney.Presentation.Core;
+using MoMoney.Testing.MetaData;
+using MoMoney.Testing.spechelpers.contexts;
+using MoMoney.Testing.spechelpers.core;
+using MoMoney.Utility.Core;
+
+namespace MoMoney.Presentation.Presenters.Commands
+{
+    [Concern(typeof (LoadPresentationModulesCommand))]
+    public class when_loading_the_application_shell : concerns_for<ILoadPresentationModulesCommand, LoadPresentationModulesCommand>
+    {
+        it should_initialize_all_the_presentation_modules = () => module.was_told_to(x => x.run());
+
+        context c = () =>
+                        {
+                            registry = the_dependency<IRegistry<IPresentationModule>>();
+                            module = an<IPresentationModule>();
+                            when_the(registry).is_told_to(r => r.all()).it_will_return(module);
+                        };
+
+        because b = () => sut.run();
+
+        static IRegistry<IPresentationModule> registry;
+        static IPresentationModule module;
+    }
+}
\ No newline at end of file
trunk/product/MyMoney/Presentation/Presenters/Navigation/MainMenuPresenter.cs
@@ -1,8 +1,8 @@
-using MoMoney.Domain.Core;
 using MoMoney.Infrastructure.eventing;
 using MoMoney.Presentation.Core;
 using MoMoney.Presentation.Model.messages;
 using MoMoney.Presentation.Views.Navigation;
+using MoMoney.Utility.Core;
 using MoMoney.Utility.Extensions;
 
 namespace MoMoney.Presentation.Presenters.Navigation
@@ -27,11 +27,11 @@ namespace MoMoney.Presentation.Presenters.Navigation
         public void run()
         {
             broker.subscribe_to(this);
+            registry.all().each(x => view.add(x.create()));
         }
 
         public void notify(new_project_opened message)
         {
-            registry.all().each(x => view.add(x.create()));
             view.display();
         }
     }
trunk/product/MyMoney/Presentation/Presenters/Navigation/NavigationPresenter.cs
@@ -14,7 +14,7 @@ namespace MoMoney.Presentation.Presenters.Navigation
     {
         readonly INavigationView view;
         readonly INavigationTreeVisitor tree_view_visitor;
-        IEventAggregator broker;
+        readonly IEventAggregator broker;
 
         public NavigationPresenter(INavigationView view, INavigationTreeVisitor tree_view_visitor,
                                    IEventAggregator broker)
trunk/product/MyMoney/Presentation/Presenters/Shell/ApplicationShellPresenter.cs
@@ -0,0 +1,41 @@
+using MoMoney.Infrastructure.eventing;
+using MoMoney.Presentation.Core;
+using MoMoney.Presentation.Model.messages;
+using MoMoney.Presentation.Views.Shell;
+
+namespace MoMoney.Presentation.Presenters.Shell
+{
+    public interface IApplicationShellPresenter : IPresentationModule, IEventSubscriber<new_project_opened>,
+                                                  IEventSubscriber<closing_project_event>
+    {
+    }
+
+    public class ApplicationShellPresenter : IApplicationShellPresenter
+    {
+        readonly IShell shell;
+        readonly IEventAggregator broker;
+
+        public ApplicationShellPresenter(IEventAggregator broker, IShell shell)
+        {
+            this.broker = broker;
+            this.shell = shell;
+        }
+
+        public void run()
+        {
+            broker.subscribe_to<new_project_opened>(this);
+            broker.subscribe_to<closing_project_event>(this);
+        }
+
+        public void notify(new_project_opened message)
+        {
+            //shell.clear_menu_items();
+            //shell.close_all_windows();
+        }
+
+        public void notify(closing_project_event message)
+        {
+            shell.close_all_windows();
+        }
+    }
+}
\ No newline at end of file
trunk/product/MyMoney/Presentation/Presenters/Shell/GettingStartedPresenter.cs
@@ -24,8 +24,8 @@ namespace MoMoney.Presentation.Presenters.Shell
 
         public void run()
         {
-            view.display();
             broker.subscribe_to(this);
+            //view.display();
         }
 
         public void notify(new_project_opened message)
trunk/product/MyMoney/Presentation/Presenters/Shell/LoadApplicationShellSpecs.cs
@@ -1,47 +0,0 @@
-using jpboodhoo.bdd.contexts;
-using MoMoney.Presentation.Core;
-using MoMoney.Presentation.Presenters.Commands;
-using MoMoney.Presentation.Views.Shell;
-using MoMoney.Testing.MetaData;
-using MoMoney.Testing.spechelpers.contexts;
-using MoMoney.Testing.spechelpers.core;
-
-namespace MoMoney.Presentation.Presenters.Shell
-{
-    [Concern(typeof (LoadApplicationShell))]
-    public class when_loading_the_application_shell : concerns_for<ILoadApplicationShellCommand, LoadApplicationShell>
-    {
-        it should_initialize_all_the_application_shell_presenters =
-            () => controller.was_told_to(x => x.run(correct_presenter));
-
-        it should_not_initialize_any_presenters_that_are_not_part_of_the_main_application_shell =
-            () => controller.should_not_have_been_asked_to(x => x.run(incorrect_presenter));
-
-        context c = () =>
-                        {
-                            registry = the_dependency<IPresenterRegistry>();
-                            controller = the_dependency<IApplicationController>();
-                            shell = the_dependency<IShell>();
-
-                            correct_presenter = an<IPresentationModule>();
-                            incorrect_presenter = an<IPresenter>();
-
-                            when_the(registry)
-                                .is_told_to(r => r.all())
-                                .it_will_return(correct_presenter, incorrect_presenter);
-                        };
-
-        because b = () => sut.run();
-
-        //public override ILoadApplicationShellCommand create_sut()
-        //{
-        //    return new LoadApplicationShell(registry, controller, shell);
-        //}
-
-        static IPresenterRegistry registry;
-        static IPresentationModule correct_presenter;
-        static IPresenter incorrect_presenter;
-        static IApplicationController controller;
-        static IShell shell;
-    }
-}
\ No newline at end of file
trunk/product/MyMoney/Presentation/Presenters/Shell/UnhandledErrorPresenter.cs
@@ -5,7 +5,7 @@ using MoMoney.Presentation.Views.Shell;
 
 namespace MoMoney.Presentation.Presenters.Shell
 {
-    public interface IUnhandledErrorPresenter : IPresentationModule, IEventSubscriber<unhandled_error_occurred>
+    public interface IUnhandledErrorPresenter : IPresentationModule, IPresenter, IEventSubscriber<unhandled_error_occurred>
     {
     }
 
trunk/product/MyMoney/Presentation/Views/core/ApplicationWindow.cs
@@ -1,4 +1,5 @@
-using System.Windows.Forms;
+using System;
+using System.Windows.Forms;
 using MoMoney.Presentation.Resources;
 
 namespace MoMoney.Presentation.Views.core
@@ -29,9 +30,16 @@ namespace MoMoney.Presentation.Views.core
             return this;
         }
 
-        //public void execute(Action action)
-        //{
-        //    BeginInvoke(action);
-        //}
+        public void on_ui_thread(Action action)
+        {
+            if (InvokeRequired)
+            {
+                BeginInvoke(action);
+            }
+            else
+            {
+                action();
+            }
+        }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Presentation/Views/Shell/ApplicationShell.cs
@@ -19,36 +19,42 @@ namespace MoMoney.Presentation.Views.Shell
 
         public void add(IDockedContentView view)
         {
-            view.add_to(ux_dock_panel);
+            on_ui_thread(() => view.add_to(ux_dock_panel));
         }
 
         public void add_to_main_menu(ToolStripMenuItem item)
         {
-            ux_main_menu_strip.Items.Add(item);
+            on_ui_thread(() => ux_main_menu_strip.Items.Add(item));
         }
 
         public void add_to_tool_bar(ToolStripItem item)
         {
-            ux_tool_bar_strip.Items.Add(item);
+            on_ui_thread(() => ux_tool_bar_strip.Items.Add(item));
         }
 
         public void close_the_active_window()
         {
-            ux_dock_panel.ActiveDocument.DockHandler.Close();
+            on_ui_thread(() => ux_dock_panel.ActiveDocument.DockHandler.Close());
         }
 
         public void close_all_windows()
         {
-            while (ux_dock_panel.Contents.Count > 0)
-            {
-                ux_dock_panel.Contents[0].DockHandler.Close();
-            }
+            on_ui_thread(() =>
+                             {
+                                 while (ux_dock_panel.Contents.Count > 0)
+                                 {
+                                     ux_dock_panel.Contents[0].DockHandler.Close();
+                                 }
+                             });
         }
 
         public void clear_menu_items()
         {
-            ux_tool_bar_strip.Items.Clear();
-            ux_main_menu_strip.Items.Clear();
+            on_ui_thread(() =>
+                             {
+                                 ux_tool_bar_strip.Items.Clear();
+                                 ux_main_menu_strip.Items.Clear();
+                             });
         }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Presentation/Views/Shell/UnhandledErrorView.cs
@@ -18,7 +18,14 @@ namespace MoMoney.Presentation.Views.Shell
 
         public void display(Exception exception)
         {
-            ux_message.Text = exception.ToString();
+            if (InvokeRequired)
+            {
+                on_ui_thread(() => ux_message.Text = exception.ToString());
+            }
+            else
+            {
+                ux_message.Text = exception.ToString();
+            }
         }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Utility/Core/command.cs → trunk/product/MyMoney/Utility/Core/DisposableCommand.cs
@@ -2,11 +2,11 @@ using System;
 
 namespace MoMoney.Utility.Core
 {
-    internal class command : IDisposableCommand
+    internal class DisposableCommand : IDisposableCommand
     {
-        private readonly Action action;
+        readonly Action action;
 
-        public command(Action action)
+        public DisposableCommand(Action action)
         {
             this.action = action;
         }
@@ -17,6 +17,7 @@ namespace MoMoney.Utility.Core
         }
 
         public void Dispose()
-        {}
+        {
+        }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Domain/Core/IRegistry.cs → trunk/product/MyMoney/Utility/Core/IRegistry.cs
@@ -1,6 +1,6 @@
 using System.Collections.Generic;
 
-namespace MoMoney.Domain.Core
+namespace MoMoney.Utility.Core
 {
     public interface IRegistry<T>
     {
trunk/product/MyMoney/Utility/Extensions/RegistryExtensions.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MoMoney.Utility.Core;
+
+namespace MoMoney.Utility.Extensions
+{
+    public static class RegistryExtensions
+    {
+        public static K find_an_implementation_of<T, K>(this IRegistry<T> registry) where K : T
+        {
+            try
+            {
+                return registry
+                    .all()
+                    .Single(p => p.is_an_implementation_of<K>())
+                    .downcast_to<K>();
+            }
+            catch (Exception exception)
+            {
+                throw new Exception("Could Not Find an implementation of".formatted_using(typeof (K)), exception);
+            }
+        }
+
+        public static IEnumerable<T> sort_all_using<T>(this IRegistry<T> registry, IComparer<T> comparer)
+        {
+            return registry.all().sorted_using(comparer);
+        }
+    }
+}
\ No newline at end of file
trunk/product/MyMoney/windows.ui/wire_up_the_views_in_to_the.cs
@@ -29,7 +29,6 @@ namespace MoMoney.windows.ui
         {
             register.singleton<IShell, ApplicationShell>();
             //register.proxy(new SynchronizedViewProxyConfiguration<IShell>(), () => new ApplicationShell());
-            //register.proxy(new ShellConfiguration(), () => new ApplicationShell());
             register.singleton<the_application_context, the_application_context>();
             register.transient<IAboutApplicationView, AboutTheApplicationView>();
             register.transient<ISplashScreenView, SplashScreenView>();
@@ -56,19 +55,4 @@ namespace MoMoney.windows.ui
             item.add_interceptor<SynchronizedInterceptor<T>>();
         }
     }
-
-    internal class ShellConfiguration : IConfiguration<IProxyBuilder<IShell>>
-    {
-        public void configure(IProxyBuilder<IShell> item)
-        {
-            IShell shell = item.add_interceptor<SynchronizedInterceptor<IShell>>().InterceptOn;
-            shell.add(null);
-            shell.add_to_main_menu(null);
-            shell.add_to_tool_bar(null);
-            shell.clear_menu_items();
-            shell.close_all_windows();
-            shell.close_the_active_window();
-            shell.status_bar();
-        }
-    }
 }
\ No newline at end of file
trunk/product/MyMoney/MyMoney.csproj
@@ -249,7 +249,6 @@
     <Compile Include="Domain\Core\Money.cs" />
     <Compile Include="Domain\Core\Month.cs" />
     <Compile Include="Domain\Core\Months.cs" />
-    <Compile Include="Domain\Core\registry_extensions.cs" />
     <Compile Include="Infrastructure\Container\Windsor\configuration\ComponentRegistrationConfiguration.cs" />
     <Compile Include="Infrastructure\System\application_environment.cs" />
     <Compile Include="Infrastructure\Threading\BackgroundThreadFactory.cs" />
@@ -271,7 +270,6 @@
     <Compile Include="Infrastructure\transactions\UnitOfWorkRegistry.cs" />
     <Compile Include="Infrastructure\transactions\UnitOfWorkRegistrySpecs.cs" />
     <Compile Include="Infrastructure\transactions\unit_of_work_specs.cs" />
-    <Compile Include="Presentation\Core\could_not_find_presenter.cs" />
     <Compile Include="Presentation\Core\IContentPresenter.cs" />
     <Compile Include="Presentation\Databindings\date_time_picker_property_binding.cs" />
     <Compile Include="Presentation\Databindings\date_time_property_binding_specs.cs" />
@@ -296,7 +294,7 @@
     <Compile Include="Presentation\Model\Navigation\branches\add_new_income_branch.cs" />
     <Compile Include="Presentation\Model\Navigation\branches\view_all_bills_branch.cs" />
     <Compile Include="Presentation\Model\Navigation\branches\view_all_bills_report_branch.cs" />
-    <Compile Include="Presentation\Model\Projects\current_project.cs" />
+    <Compile Include="Presentation\Model\Projects\CurrentProject.cs" />
     <Compile Include="Presentation\Core\PresenterRegistry.cs" />
     <Compile Include="Presentation\Model\Menu\create.cs" />
     <Compile Include="Presentation\Model\Menu\File\Commands\ExitCommand.cs" />
@@ -316,7 +314,7 @@
     <Compile Include="Presentation\Model\Navigation\tree_branch.cs" />
     <Compile Include="Presentation\Model\Navigation\tree_branch_specs.cs" />
     <Compile Include="Presentation\Model\Navigation\tree_view_to_root_node_mapper.cs" />
-    <Compile Include="Presentation\Model\Projects\current_project_specs.cs" />
+    <Compile Include="Presentation\Model\Projects\CurrentProjectSpecs.cs" />
     <Compile Include="Presentation\Model\Projects\file.cs" />
     <Compile Include="Presentation\Model\Projects\file_not_specified_exception.cs" />
     <Compile Include="Presentation\Model\reporting\IReport.cs" />
@@ -362,6 +360,7 @@
     <Compile Include="Presentation\Presenters\Navigation\ExpandoBuilder.cs" />
     <Compile Include="Presentation\Presenters\Navigation\ExpandoItemBuilder.cs" />
     <Compile Include="Presentation\Presenters\Navigation\IActionTaskPaneFactory.cs" />
+    <Compile Include="Presentation\Presenters\Shell\ApplicationShellPresenter.cs" />
     <Compile Include="Presentation\Presenters\Shell\GettingStartedPresenter.cs" />
     <Compile Include="Presentation\Presenters\Shell\GettingStartedPresenterSpecs.cs" />
     <Compile Include="Presentation\Presenters\Shell\ToolBarPresenter.cs" />
@@ -369,7 +368,7 @@
     <Compile Include="Presentation\Presenters\Navigation\NavigationPresenter.cs" />
     <Compile Include="Presentation\Presenters\Navigation\NavigationPresenterSpecs.cs" />
     <Compile Include="Presentation\Presenters\reporting\ReportPresenter.cs" />
-    <Compile Include="Presentation\Presenters\Shell\LoadApplicationShellSpecs.cs" />
+    <Compile Include="Presentation\Presenters\Commands\LoadPresentationModulesCommandSpecs.cs" />
     <Compile Include="Presentation\Presenters\Shell\NotificationIconPresenterSpecs.cs" />
     <Compile Include="Presentation\Presenters\Shell\TaskTrayPresenter.cs" />
     <Compile Include="Presentation\Presenters\Shell\TitleBarPresenter.cs" />
@@ -521,7 +520,7 @@
     <Compile Include="Utility\Core\ChainedConfiguration.cs" />
     <Compile Include="Utility\Core\chained_mapper.cs" />
     <Compile Include="Utility\Core\and_specification.cs" />
-    <Compile Include="Utility\Core\command.cs" />
+    <Compile Include="Utility\Core\DisposableCommand.cs" />
     <Compile Include="Utility\Core\empty_command.cs" />
     <Compile Include="Utility\Core\IBuilder.cs" />
     <Compile Include="Utility\Core\ICallback.cs" />
@@ -558,7 +557,7 @@
     <Compile Include="Presentation\Databindings\text_property_binding.cs" />
     <Compile Include="Presentation\Presenters\Commands\display_the_splash_screen.cs" />
     <Compile Include="Presentation\Core\IPresentationModule.cs" />
-    <Compile Include="Presentation\Core\presenter_registry_extensions.cs" />
+    <Compile Include="Utility\Extensions\RegistryExtensions.cs" />
     <Compile Include="Presentation\Model\Menu\File\FileMenu.cs" />
     <Compile Include="Presentation\Model\Menu\Help\help_menu.cs" />
     <Compile Include="Utility\Core\ISpecification.cs" />
@@ -620,7 +619,7 @@
     <Compile Include="windows.ui\check_for_updates.cs" />
     <Compile Include="windows.ui\hookup.cs" />
     <Compile Include="Presentation\Model\Menu\ISubMenu.cs" />
-    <Compile Include="Domain\Core\IRegistry.cs" />
+    <Compile Include="Utility\Core\IRegistry.cs" />
     <Compile Include="Infrastructure\Container\dependency_resolution_exception.cs" />
     <Compile Include="Infrastructure\Container\Resolve.cs" />
     <Compile Include="Infrastructure\Container\ResolveSpecs.cs" />
@@ -630,12 +629,12 @@
     <Compile Include="Utility\Core\IMapper.cs" />
     <Compile Include="Utility\Extensions\string_extensions.cs" />
     <Compile Include="Presentation\Model\Menu\File\Commands\exit_command_specs.cs" />
-    <Compile Include="Presentation\Core\application_controller_specs.cs" />
-    <Compile Include="Presentation\Core\application_controller.cs" />
+    <Compile Include="Presentation\Core\ApplicationControllerSpecs.cs" />
+    <Compile Include="Presentation\Core\ApplicationController.cs" />
     <Compile Include="Presentation\Core\IPresenter.cs" />
     <Compile Include="Infrastructure\Container\IDependencyRegistry.cs" />
     <Compile Include="Presentation\Presenters\Menu\MainMenuPresenterSpecs.cs" />
-    <Compile Include="Presentation\Presenters\Commands\LoadApplicationShell.cs" />
+    <Compile Include="Presentation\Presenters\Commands\LoadPresentationModulesCommand.cs" />
     <Compile Include="Presentation\Views\Menu\ApplicationMenuHostSpecs.cs" />
     <Compile Include="windows.ui\bootstrap.cs" />
     <EmbeddedResource Include="Presentation\Views\AddCompanyView.resx">
@@ -732,6 +731,7 @@
     <Compile Include="windows.ui\wire_up_the_views_in_to_the.cs" />
   </ItemGroup>
   <ItemGroup>
+    <Folder Include="Presentation\module\" />
     <Folder Include="Tasks\domain\" />
     <Folder Include="Tasks\Stubs\" />
     <Folder Include="Testing\spechelpers\concerns\" />