Commit 23546d2

unknown <mo@.(none)>
2010-01-24 18:29:55
started removing unneccessary interfaces.
1 parent fad0610
product/Boot/boot/container/registration/wire_up_the_essential_services_into_the.cs
@@ -1,4 +1,3 @@
-using Gorilla.Commons.Infrastructure.Container;
 using Gorilla.Commons.Infrastructure.Logging;
 using gorilla.commons.infrastructure.thirdparty;
 using gorilla.commons.infrastructure.thirdparty.Log4Net;
@@ -17,8 +16,8 @@ namespace MoMoney.boot.container.registration
 
         public void run()
         {
-            registration.singleton<DependencyRegistration>(() => registration);
-            registration.singleton<DependencyRegistry>(() => registration.build());
+            registration.singleton(() => registration);
+            registration.singleton(() => registration.build());
             registration.singleton<LogFactory, Log4NetLogFactory>();
         }
     }
product/Boot/boot/container/registration/wire_up_the_infrastructure_in_to_the.cs
@@ -1,4 +1,3 @@
-using System.Collections;
 using System.ComponentModel;
 using System.Deployment.Application;
 using Gorilla.Commons.Infrastructure.Registries;
@@ -37,10 +36,10 @@ namespace MoMoney.boot.container.registration
             registry.singleton<IContext>(() => new PerThread());
 
             registry.singleton(() => AsyncOperationManager.SynchronizationContext);
-            registry.singleton<AsyncOperation>(() => AsyncOperationManager.CreateOperation(new object()));
-            registry.singleton<ApplicationDeployment>(
+            registry.singleton(() => AsyncOperationManager.CreateOperation(new object()));
+            registry.singleton(
                 () => ApplicationDeployment.IsNetworkDeployed ? ApplicationDeployment.CurrentDeployment : null);
-            registry.singleton<IDeployment>(
+            registry.singleton(
                 () =>
                 ApplicationDeployment.IsNetworkDeployed
                     ? (IDeployment) new CurrentDeployment()
product/Boot/boot/container/registration/wire_up_the_presentation_modules.cs
@@ -31,7 +31,7 @@ namespace MoMoney.boot.container.registration
         public void run(Assembly item)
         {
             Func<IApplicationController> target =
-                () => new ApplicationController(Lazy.load<IPresenterRegistry>(), Lazy.load<IShell>());
+                () => new ApplicationController(Lazy.load<IShell>(), Lazy.load<PresenterFactory>());
             registry.proxy<IApplicationController, SynchronizedConfiguration<IApplicationController>>(target.memorize());
             registry.transient(typeof (IRunThe<>), typeof (RunThe<>));
             registry.transient<IFileMenu, FileMenu>();
product/Boot/Properties/Resources.Designer.cs
@@ -9,9 +9,6 @@
 //------------------------------------------------------------------------------
 
 namespace momoney.Properties {
-    using System;
-    
-    
     /// <summary>
     ///   A strongly-typed resource class, for looking up localized strings, etc.
     /// </summary>
product/database/transactions/SessionSpecs.cs
@@ -128,7 +128,7 @@ namespace momoney.database.transactions
                 wrong_item = an<ITestEntity>();
                 correct_item = an<ITestEntity>();
                 map = an<IIdentityMap<Guid, ITestEntity>>();
-                when_the(wrong_item).is_told_to(x => x.id).it_will_return<Id<Guid>>(Guid.NewGuid());
+                when_the(wrong_item).is_told_to(x => x.id).it_will_return(Guid.NewGuid());
                 when_the(correct_item).is_told_to(x => x.id).it_will_return(id);
                 when_the(database)
                     .is_told_to(x => x.fetch_all<ITestEntity>())
product/Domain/Accounting/AccountHolderSpecs.cs
@@ -2,7 +2,6 @@ using System;
 using System.Collections.Generic;
 using developwithpassion.bdd.contexts;
 using Gorilla.Commons.Testing;
-using Gorilla.Commons.Utility;
 using MoMoney.Domain.Accounting;
 using MoMoney.Domain.Core;
 
@@ -55,14 +54,14 @@ namespace MoMoney.Domain.accounting
                             income_for_february_2007 = an<IIncome>();
                             income_for_february_2008 = an<IIncome>();
 
-                            income_for_january_2007.is_told_to(x => x.date_of_issue).it_will_return<Date>( new DateTime(2007, 01, 01));
+                            income_for_january_2007.is_told_to(x => x.date_of_issue).it_will_return( new DateTime(2007, 01, 01));
                             income_for_january_2007.is_told_to(x => x.amount_tendered).it_will_return(new Money(1000, 00));
 
-                            income_for_february_2007.is_told_to(x => x.date_of_issue).it_will_return<Date>( new DateTime(2007, 02, 01));
+                            income_for_february_2007.is_told_to(x => x.date_of_issue).it_will_return( new DateTime(2007, 02, 01));
                             income_for_february_2007.is_told_to(x => x.amount_tendered).it_will_return(new Money(1000,
                                                                                                                  00));
 
-                            income_for_february_2008.is_told_to(x => x.date_of_issue).it_will_return<Date>( new DateTime(2008, 02, 01));
+                            income_for_february_2008.is_told_to(x => x.date_of_issue).it_will_return( new DateTime(2008, 02, 01));
                             income_for_february_2008.is_told_to(x => x.amount_tendered).it_will_return(new Money(1000, 00));
                         };
 
product/Presentation/Core/ApplicationController.cs
@@ -10,34 +10,27 @@ namespace MoMoney.Presentation.Core
 
     public class ApplicationController : IApplicationController, ParameterizedCommand<IPresenter>
     {
-        readonly IPresenterRegistry registered_presenters;
         readonly IShell shell;
+        PresenterFactory factory;
 
-        public ApplicationController(IPresenterRegistry registered_presenters, IShell shell)
+        public ApplicationController(IShell shell, PresenterFactory factory)
         {
-            this.registered_presenters = registered_presenters;
+            this.factory = factory;
             this.shell = shell;
         }
 
         public void run<Presenter>() where Presenter : IPresenter
         {
-            run(registered_presenters.find_an_implementation_of<IPresenter, Presenter>());
+            run(factory.create<Presenter>());
         }
 
         public void run(IPresenter presenter)
         {
-            presenter.run();
+            presenter.present();
             if (presenter.is_an_implementation_of<IContentPresenter>())
             {
                 var content_presenter = presenter.downcast_to<IContentPresenter>();
-                var view = content_presenter.View;
-
-                //view.on_activated = x => content_presenter.activate();
-                //view.deactivated = x => content_presenter.deactivate();
-                //view.on_closing = x => x.Cancel = !content_presenter.can_close();
-                //view.closed = x => remove(presenter);
-
-                shell.add(view);
+                shell.add(content_presenter.View);
             }
         }
     }
product/Presentation/Core/ApplicationControllerSpecs.cs
@@ -34,7 +34,7 @@ namespace MoMoney.Presentation.Core
         it should_ask_the_registered_presenters_for_an_instance_of_the_presenter_to_run =
             () => presenter_registry.was_told_to(r => r.all());
 
-        it should_initialize_the_presenter_to_run = () => implementation_of_the_presenter.was_told_to(p => p.run());
+        it should_initialize_the_presenter_to_run = () => implementation_of_the_presenter.was_told_to(p => p.present());
 
         static IPresenter implementation_of_the_presenter;
     }
product/Presentation/Core/CachedPresenterFactory.cs
@@ -0,0 +1,24 @@
+using gorilla.commons.utility;
+
+namespace MoMoney.Presentation.Core
+{
+    public interface PresenterFactory
+    {
+        Presenter create<Presenter>() where Presenter : IPresenter;
+    }
+
+    public class CachedPresenterFactory : PresenterFactory
+    {
+        readonly IPresenterRegistry registered_presenters;
+
+        public CachedPresenterFactory(IPresenterRegistry registered_presenters)
+        {
+            this.registered_presenters = registered_presenters;
+        }
+
+        public Presenter create<Presenter>() where Presenter : IPresenter
+        {
+            return registered_presenters.find_an_implementation_of<IPresenter, Presenter>();
+        }
+    }
+}
\ No newline at end of file
product/Presentation/Core/ContentPresenter.cs
@@ -16,7 +16,7 @@ namespace MoMoney.Presentation.Core
             get { return view; }
         }
 
-        public abstract void run();
+        public abstract void present();
 
         public virtual void activate()
         {
product/Presentation/Core/IPresenter.cs
@@ -1,6 +1,7 @@
-using gorilla.commons.utility;
-
 namespace MoMoney.Presentation.Core
 {
-    public interface IPresenter : Command {}
+    public interface IPresenter
+    {
+        void present();
+    }
 }
\ No newline at end of file
product/Presentation/Model/Menu/File/SaveChangesCommand.cs
@@ -37,7 +37,7 @@ namespace MoMoney.Presentation.Model.Menu.File
             this.view = view;
         }
 
-        public void run()
+        public void present()
         {
             throw new NotImplementedException();
         }
product/Presentation/Model/Menu/Help/DisplayInformationAboutTheApplication.cs
@@ -4,7 +4,9 @@ using MoMoney.Presentation.Presenters;
 
 namespace MoMoney.Presentation.model.menu.help
 {
-    public interface IDisplayInformationAboutTheApplication : Command {}
+    public interface IDisplayInformationAboutTheApplication : Command
+    {
+    }
 
     public class DisplayInformationAboutTheApplication : IDisplayInformationAboutTheApplication
     {
@@ -15,7 +17,7 @@ namespace MoMoney.Presentation.model.menu.help
 
         public void run()
         {
-            run_presenter.run<IAboutApplicationPresenter>();
+            run_presenter.run<AboutTheApplicationPresenter>();
         }
 
         readonly IRunPresenterCommand run_presenter;
product/Presentation/Model/Navigation/AddBillPaymentBranch.cs
@@ -15,7 +15,7 @@ namespace MoMoney.Presentation.Model.Navigation
 
         public void visit(ITreeBranch item_to_visit)
         {
-            item_to_visit.add_child("Bill Payments", ApplicationIcons.AddIncome, () => command.run<IAddBillPaymentPresenter>());
+            item_to_visit.add_child("Bill Payments", ApplicationIcons.AddIncome, () => command.run<AddBillPaymentPresenter>());
         }
     }
 }
\ No newline at end of file
product/Presentation/Presenters/AboutTheApplicationPresenter.cs
@@ -3,17 +3,13 @@ using momoney.presentation.views;
 
 namespace momoney.presentation.presenters
 {
-    public interface IAboutApplicationPresenter : IContentPresenter
-    {
-    }
-
-    public class AboutTheApplicationPresenter : ContentPresenter<IAboutApplicationView>, IAboutApplicationPresenter
+    public class AboutTheApplicationPresenter : ContentPresenter<IAboutApplicationView>
     {
         public AboutTheApplicationPresenter(IAboutApplicationView view) : base(view)
         {
         }
 
-        public override void run()
+        public override void present()
         {
         }
     }
product/Presentation/Presenters/AddBillingTaskPane.cs
@@ -22,7 +22,7 @@ namespace MoMoney.Presentation.Presenters
                 Build.task_pane_item()
                     .named("Add Bill Payments")
                     .represented_by_icon(ApplicationIcons.AddBillPayment)
-                    .when_clicked_execute(() => command.run<IAddBillPaymentPresenter>())
+                    .when_clicked_execute(() => command.run<AddBillPaymentPresenter>())
                 )
                 .with_item(
                 Build.task_pane_item()
product/Presentation/Presenters/AddBillPaymentPresenter.cs
@@ -7,12 +7,7 @@ using MoMoney.Service.Contracts.Application;
 
 namespace momoney.presentation.presenters
 {
-    public interface IAddBillPaymentPresenter : IContentPresenter
-    {
-        void submit_bill_payment(AddNewBillDTO dto);
-    }
-
-    public class AddBillPaymentPresenter : ContentPresenter<IAddBillPaymentView>, IAddBillPaymentPresenter
+    public class AddBillPaymentPresenter : ContentPresenter<IAddBillPaymentView>
     {
         readonly ICommandPump pump;
 
@@ -21,7 +16,7 @@ namespace momoney.presentation.presenters
             this.pump = pump;
         }
 
-        public override void run()
+        public override void present()
         {
             view.attach_to(this);
             pump
product/Presentation/Presenters/AddCompanyPresenter.cs
@@ -20,7 +20,7 @@ namespace MoMoney.Presentation.Presenters
             this.pump = pump;
         }
 
-        public override void run()
+        public override void present()
         {
             view.attach_to(this);
             pump.run<IEnumerable<CompanyDTO>, IGetAllCompanysQuery>(view);
product/Presentation/Presenters/AddCompanyPresenterSpecs.cs
@@ -24,7 +24,7 @@ namespace MoMoney.Presentation.Presenters
     {
         it should_display_the_correct_screen = () => view.was_told_to(x => x.attach_to(sut));
 
-        because b = () => sut.run();
+        because b = () => sut.present();
     }
 
     [Concern(typeof (AddCompanyPresenter))]
product/Presentation/Presenters/AddNewIncomePresenter.cs
@@ -20,7 +20,7 @@ namespace MoMoney.Presentation.Presenters
             this.pump = pump;
         }
 
-        public override void run()
+        public override void present()
         {
             view.attach_to(this);
             pump.run<IEnumerable<CompanyDTO>, IGetAllCompanysQuery>(view);
product/Presentation/Presenters/AddNewIncomePresenterSpecs.cs
@@ -51,6 +51,6 @@ namespace momoney.presentation.presenters
 
         context c = () => { };
 
-        because b = () => sut.run();
+        because b = () => sut.present();
     }
 }
\ No newline at end of file
product/Presentation/Presenters/ApplicationMenuPresenter.cs
@@ -19,7 +19,7 @@ namespace momoney.presentation.presenters
             this.shell = shell;
         }
 
-        public void run()
+        public void present()
         {
             shell.region<MenuStrip>(x => registry.all().each(y => y.add_to(x)));
         }
product/Presentation/Presenters/ApplicationShellPresenter.cs
@@ -24,7 +24,7 @@ namespace momoney.presentation.presenters
             this.shell = shell;
         }
 
-        public void run()
+        public void present()
         {
             broker.subscribe(this);
             shell.attach_to(this);
product/Presentation/Presenters/CheckForUpdatesPresenter.cs
@@ -27,7 +27,7 @@ namespace momoney.presentation.presenters
             this.view = view;
         }
 
-        public void run()
+        public void present()
         {
             pump.run<ApplicationVersion, IWhatIsTheAvailableVersion>(view);
             view.attach_to(this);
product/Presentation/Presenters/CheckForUpdatesPresenterSpecs.cs
@@ -32,7 +32,7 @@ namespace momoney.presentation.presenters
         it should_go_and_find_out_what_the_latest_version_is =
             () => pump.was_told_to(x => x.run<ApplicationVersion, IWhatIsTheAvailableVersion>(view));
 
-        because b = () => sut.run();
+        because b = () => sut.present();
     }
 
     public class when_initiating_an_update_and_one_is_available : behaves_like_check_for_updates_presenter
product/Presentation/Presenters/GettingStartedPresenter.cs
@@ -13,7 +13,7 @@ namespace momoney.presentation.presenters
         {
         }
 
-        public override void run()
+        public override void present()
         {
             view.attach_to(this);
         }
product/Presentation/Presenters/GettingStartedPresenterSpecs.cs
@@ -24,7 +24,7 @@ namespace momoney.presentation.presenters
         {
             it should_display_the_getting_started_screen = () => view.was_told_to(x => x.attach_to(sut));
 
-            because b = () => sut.run();
+            because b = () => sut.present();
         }
     }
 }
\ No newline at end of file
product/Presentation/Presenters/LogFilePresenter.cs
@@ -17,7 +17,7 @@ namespace momoney.presentation.presenters
             this.tasks = tasks;
         }
 
-        public override void run()
+        public override void present()
         {
             view.display(tasks.get_the_path_to_the_log_file());
             view.run(tasks.get_the_contents_of_the_log_file());
product/Presentation/Presenters/LogFileViewPresenterSpecs.cs
@@ -29,7 +29,7 @@ namespace momoney.presentation.presenters
             tasks.is_told_to(x => x.get_the_contents_of_the_log_file()).it_will_return(log_file_contents);
         };
 
-        because b = () => sut.run();
+        because b = () => sut.present();
 
         static string log_file_contents;
         static string log_file_path;
product/Presentation/Presenters/MainMenuPresenter.cs
@@ -17,7 +17,7 @@ namespace MoMoney.Presentation.Presenters
             this.command = command;
         }
 
-        public override void run()
+        public override void present()
         {
             all_factories().each(x => view.add(x));
         }
product/Presentation/Presenters/NavigationPresenter.cs
@@ -17,7 +17,7 @@ namespace momoney.presentation.presenters
             this.tree_view_visitor = tree_view_visitor;
         }
 
-        public override void run()
+        public override void present()
         {
             view.accept(tree_view_visitor);
         }
product/Presentation/Presenters/NavigationPresenterSpecs.cs
@@ -16,7 +16,7 @@ namespace momoney.presentation.presenters
             tree_view_visitor = the_dependency<INavigationTreeVisitor>();
         };
 
-        because b = () => sut.run();
+        because b = () => sut.present();
 
         static INavigationView view;
         static INavigationTreeVisitor tree_view_visitor;
product/Presentation/Presenters/ReportPresenter.cs
@@ -21,7 +21,7 @@ namespace MoMoney.Presentation.Presenters
             this.registry = registry;
         }
 
-        public override void run()
+        public override void present()
         {
             var report = registry.get_a<Report>();
             report.run(registry.get_a<Query>().fetch());
product/Presentation/Presenters/ToolBarPresenter.cs
@@ -25,7 +25,7 @@ namespace momoney.presentation.presenters
             this.project = project;
         }
 
-        public void run()
+        public void present()
         {
             shell.region<ToolStrip>(x => buttons().each(y => y.add_to(x)));
         }
product/Presentation/Presenters/UnhandledErrorPresenter.cs
@@ -25,7 +25,7 @@ namespace momoney.presentation.presenters
             this.broker = broker;
         }
 
-        public void run()
+        public void present()
         {
             view.attach_to(this);
             broker.subscribe_to(this);
@@ -40,5 +40,10 @@ namespace momoney.presentation.presenters
         {
             restart.run();
         }
+
+        public void run()
+        {
+            present();
+        }
     }
 }
\ No newline at end of file
product/Presentation/Presenters/ViewAllBillsPresenter.cs
@@ -20,7 +20,7 @@ namespace momoney.presentation.presenters
             this.pump = pump;
         }
 
-        public override void run()
+        public override void present()
         {
             view.attach_to(this);
             pump.run<IEnumerable<BillInformationDTO>, IGetAllBillsQuery>(view);
product/Presentation/Presenters/ViewIncomeHistoryPresenter.cs
@@ -19,7 +19,7 @@ namespace MoMoney.Presentation.Presenters
             this.pump = pump;
         }
 
-        public override void run()
+        public override void present()
         {
             view.attach_to(this);
             pump.run<IEnumerable<IncomeInformationDTO>, IGetAllIncomeQuery>(view);
product/Presentation/Views/IAddBillPaymentView.cs
@@ -6,7 +6,7 @@ using momoney.presentation.presenters;
 namespace momoney.presentation.views
 {
     public interface IAddBillPaymentView : IDockedContentView,
-                                           IView<IAddBillPaymentPresenter>,
+                                           IView<AddBillPaymentPresenter>,
                                            Callback<IEnumerable<CompanyDTO>>,
                                            Callback<IEnumerable<BillInformationDTO>> {}
 }
\ No newline at end of file
product/Presentation/Winforms/Helpers/GridListControl.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Windows.Forms;
+
+namespace MoMoney.Presentation.Winforms.Helpers
+{
+    public class GridListControl<T> : IListControl<T>
+    {
+        DataGrid grid;
+
+        public GridListControl(DataGrid grid)
+        {
+            this.grid = grid;
+        }
+
+        public T get_selected_item()
+        {
+            //grid.
+            return default(T);
+        }
+
+        public void add_item(T item)
+        {
+        }
+
+        public void set_selected_item(T item)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}
\ No newline at end of file
product/Presentation/Winforms/Helpers/ListViewControl.cs
@@ -0,0 +1,30 @@
+using System.Windows.Forms;
+
+namespace MoMoney.Presentation.Winforms.Helpers
+{
+    public class ListViewControl<T> : IListControl<T>
+    {
+        ListView control;
+
+        public ListViewControl(ListView control)
+        {
+            this.control = control;
+        }
+
+        public T get_selected_item()
+        {
+            //return control.SelectedItems.First();
+            return default(T);
+        }
+
+        public void add_item(T item)
+        {
+            control.Items.Add(new ListViewItem(item.ToString()) {Tag = item});
+        }
+
+        public void set_selected_item(T item)
+        {
+            //control.SelectedItems
+        }
+    }
+}
\ No newline at end of file
product/Presentation/Winforms/Views/AddBillPaymentView.cs
@@ -23,7 +23,7 @@ namespace MoMoney.Presentation.Winforms.Views
             companies_list = ux_company_names.create_for<CompanyDTO>();
         }
 
-        public void attach_to(IAddBillPaymentPresenter presenter)
+        public void attach_to(AddBillPaymentPresenter presenter)
         {
             submit_clicked = x => presenter.submit_bill_payment(create_dto());
         }
product/Presentation/Presentation.csproj
@@ -103,6 +103,7 @@
     </Reference>
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="core\CachedPresenterFactory.cs" />
     <Compile Include="model\eventing\FinishedRunningCommand.cs" />
     <Compile Include="model\eventing\StartedRunningCommand.cs" />
     <Compile Include="model\navigation\INavigationTreeVisitor.cs" />
@@ -240,6 +241,8 @@
     <Compile Include="views\IApplicationDockedWindow.cs" />
     <Compile Include="views\IApplicationWindow.cs" />
     <Compile Include="views\IViewAllIncomeReport.cs" />
+    <Compile Include="winforms\helpers\GridListControl.cs" />
+    <Compile Include="winforms\helpers\ListViewControl.cs" />
     <Compile Include="winforms\resources\ApplicationIcons.cs" />
     <Compile Include="winforms\resources\ApplicationImages.cs" />
     <Compile Include="presenters\RunQueryCommand.cs" />