Commit d2e1021

mokhan <mokhan@ce5e1baf-6525-42e4-a1b2-857ea38da20a>
2009-04-14 00:59:50
git-svn-id: https://svn.xp-dev.com/svn/mokhan-mo.money@155 ce5e1baf-6525-42e4-a1b2-857ea38da20a
1 parent 31cfa5a
trunk/product/MyMoney/boot/container/registration/wire_up_the_presentation_modules.cs
@@ -1,3 +1,4 @@
+using System;
 using System.Reflection;
 using MoMoney.Infrastructure.Container;
 using MoMoney.Infrastructure.interceptors;
@@ -30,8 +31,8 @@ namespace MoMoney.boot.container.registration
 
         public void run(IAssembly item)
         {
-            registry.proxy<IApplicationController, SynchronizedConfiguration<IApplicationController>>(
-                () => new ApplicationController(Lazy.load<IPresenterRegistry>(), Lazy.load<IShell>()));
+            Func<IApplicationController> target = () => new ApplicationController(Lazy.load<IPresenterRegistry>(), Lazy.load<IShell>());
+            registry.proxy<IApplicationController, SynchronizedConfiguration<IApplicationController>>( target.memorize());
             registry.transient(typeof (IRunThe<>), typeof (RunThe<>));
             registry.transient<IFileMenu, FileMenu>();
             registry.transient<IWindowMenu, WindowMenu>();
trunk/product/MyMoney/boot/container/registration/wire_up_the_services_in_to_the.cs
@@ -1,4 +1,3 @@
-using System;
 using MoMoney.DataAccess.core;
 using MoMoney.Domain.accounting.billing;
 using MoMoney.Domain.repositories;
@@ -23,9 +22,7 @@ namespace MoMoney.boot.container.registration
         public void run()
         {
             registry.proxy<IBillingTasks, ServiceLayerConfiguration<IBillingTasks>>(
-                () => new BillingTasks(Lazy.load<IBillRepository>(),
-                                       Lazy.load<ICompanyRepository>(),
-                                       Lazy.load<ICustomerTasks>()));
+                () => new BillingTasks(Lazy.load<IBillRepository>(), Lazy.load<ICompanyRepository>()));
 
             registry.proxy<ICustomerTasks, ServiceLayerConfiguration<ICustomerTasks>>(
                 () => new CustomerTasks(Lazy.load<IDatabaseGateway>()));
@@ -35,22 +32,24 @@ namespace MoMoney.boot.container.registration
                                       Lazy.load<ICompanyRepository>(),
                                       Lazy.load<IIncomeRepository>()));
 
-
             wire_up_queries();
             wire_up_the_commands();
-
         }
 
         void wire_up_queries()
         {
             registry.proxy<IGetAllCompanysQuery, ServiceLayerConfiguration<IGetAllCompanysQuery>>(
                 () => new GetAllCompanysQuery(Lazy.load<ICompanyRepository>()));
+            registry.proxy<IGetAllBillsQuery, ServiceLayerConfiguration<IGetAllBillsQuery>>(
+                () => new GetAllBillsQuery(Lazy.load<IBillRepository>()));
         }
 
         void wire_up_the_commands()
         {
             registry.proxy<IRegisterNewCompanyCommand, ServiceLayerConfiguration<IRegisterNewCompanyCommand>>(
                 () => new RegisterNewCompanyCommand(Lazy.load<ICompanyFactory>()));
+            registry.proxy<ISaveNewBillCommand, ServiceLayerConfiguration<ISaveNewBillCommand>>(
+                () => new SaveNewBillCommand(Lazy.load<ICompanyRepository>(), Lazy.load<ICustomerTasks>()));
         }
     }
 
trunk/product/MyMoney/boot/container/registration/wire_up_the_views_in_to_the.cs
@@ -1,3 +1,5 @@
+using System.ComponentModel;
+using System.Windows.Forms;
 using MoMoney.Infrastructure.Container;
 using MoMoney.Presentation.Views;
 using MoMoney.Presentation.Views.billing;
@@ -25,6 +27,8 @@ namespace MoMoney.boot.container.registration
         {
             var shell = new ApplicationShell();
             register.singleton<IShell>(() => shell);
+            register.singleton<IWin32Window>(() => shell);
+            register.singleton<ISynchronizeInvoke>(() => shell);
             //register.proxy<IShell, SynchronizedConfiguration<IShell>>(() => shell);
             register.singleton(() => shell);
             register.transient<IAboutApplicationView, AboutTheApplicationView>();
trunk/product/MyMoney/boot/start_the_application.cs
@@ -7,16 +7,18 @@ namespace MoMoney.boot
 {
     internal class start_the_application : ICommand
     {
+        readonly IBackgroundThread thread;
         readonly ILoadPresentationModulesCommand command;
         readonly ICommandProcessor processor;
 
-        public start_the_application()
-            : this(Lazy.load<ILoadPresentationModulesCommand>(), Lazy.load<ICommandProcessor>())
+        public start_the_application(IBackgroundThread thread)
+            : this(thread,Lazy.load<ILoadPresentationModulesCommand>(), Lazy.load<ICommandProcessor>())
         {
         }
 
-        public start_the_application(ILoadPresentationModulesCommand command, ICommandProcessor processor)
+        public start_the_application(IBackgroundThread thread,ILoadPresentationModulesCommand command, ICommandProcessor processor)
         {
+            this.thread = thread;
             this.command = command;
             this.processor = processor;
         }
@@ -25,6 +27,7 @@ namespace MoMoney.boot
         {
             processor.run();
             command.run();
+            processor.add(() => thread.Dispose());
         }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/boot/WindowsFormsApplication.cs
@@ -42,8 +42,7 @@ namespace MoMoney.boot
                 .the<global_error_handling>()
                 .then(startup_screen)
                 .then<wire_up_the_container>()
-                .then(startup_screen.Dispose)
-                .then<start_the_application>()
+                .then(new start_the_application(startup_screen))
                 .run();
 
             stopwatch.Stop();
trunk/product/MyMoney/Infrastructure/transactions2/ConnectionFactory.cs
@@ -30,13 +30,13 @@ namespace MoMoney.Infrastructure.transactions2
         IObjectContainer get_container(IFile the_path_to_the_database_file, IConfiguration configuration)
         {
             var container = Db4oFactory.OpenFile(configuration, the_path_to_the_database_file.path);
-            var registry = EventRegistryFactory.ForObjectContainer(container);
-            registry.ClassRegistered +=
-                (sender, args) => this.log().debug("class registered: {0}", args.ClassMetadata());
-            registry.Instantiated += (sender, args) => this.log().debug("class instantiated: {0}", args.Object.GetType().Name);
-            registry.Committed +=
-                (sender, args) =>
-                this.log().debug("added: {0}, updated: {1}, deleted: {2}", args.Added, args.Updated, args.Deleted);
+            //var registry = EventRegistryFactory.ForObjectContainer(container);
+            //registry.ClassRegistered +=
+            //    (sender, args) => this.log().debug("class registered: {0}", args.ClassMetadata());
+            //registry.Instantiated += (sender, args) => this.log().debug("class instantiated: {0}", args.Object.GetType().Name);
+            //registry.Committed +=
+            //    (sender, args) =>
+            //    this.log().debug("added: {0}, updated: {1}, deleted: {2}", args.Added, args.Updated, args.Deleted);
             return container;
         }
     }
trunk/product/MyMoney/Presentation/Core/ApplicationController.cs
@@ -1,37 +1,51 @@
+using System;
+using System.Collections.Generic;
+using MoMoney.Infrastructure.Extensions;
 using MoMoney.Presentation.Views.Shell;
 using MoMoney.Utility.Core;
 using MoMoney.Utility.Extensions;
 
 namespace MoMoney.Presentation.Core
 {
-    public interface IApplicationController : IParameterizedCommand<IPresenter>
+    public interface IApplicationController
     {
         void run<Presenter>() where Presenter : IPresenter;
     }
 
-    public class ApplicationController : IApplicationController
+    public class ApplicationController : IApplicationController, IParameterizedCommand<IPresenter>
     {
         readonly IPresenterRegistry registered_presenters;
         readonly IShell shell;
+        //readonly IDictionary<Type, IPresenter> open_presenters;
 
         public ApplicationController(IPresenterRegistry registered_presenters, IShell shell)
         {
             this.registered_presenters = registered_presenters;
             this.shell = shell;
+            //open_presenters = new Dictionary<Type, IPresenter>();
         }
 
         public void run<Presenter>() where Presenter : IPresenter
         {
-            run(registered_presenters.find_an_implementation_of<IPresenter, Presenter>());
+            //if (open_presenters.ContainsKey(typeof(Presenter)))
+            //{
+            //    this.log().debug("from cached presenter: {0}", typeof(Presenter));
+            //    run(open_presenters[typeof(Presenter)]);
+            //}
+            //else
+            //{
+                //this.log().debug("adding presenter to cache: {0}", typeof (Presenter));
+                var presenter = registered_presenters.find_an_implementation_of<IPresenter, Presenter>();
+                //open_presenters.Add(typeof (Presenter), presenter);
+                run(presenter);
+            //}
         }
 
         public void run(IPresenter presenter)
         {
             presenter.run();
             if (presenter.is_an_implementation_of<IContentPresenter>())
-            {
                 shell.add(presenter.downcast_to<IContentPresenter>().View);
-            }
         }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Presentation/Databindings/listbox_extensions.cs → trunk/product/MyMoney/Presentation/Databindings/ListboxExtensions.cs
@@ -5,15 +5,17 @@ using MoMoney.Utility.Extensions;
 
 namespace MoMoney.Presentation.Databindings
 {
-    public static class listbox_extensions
+    public static class ListboxExtensions
     {
         public static void bind_to<T>(this ComboBox control, IEnumerable<T> items)
         {
+            control.Items.Clear();
             items.each(x => control.Items.Add(x));
         }
 
         public static void bind_to<T>(this KryptonComboBox control, IEnumerable<T> items)
         {
+            control.Items.Clear();
             items.each(x => control.Items.Add(x));
         }
     }
trunk/product/MyMoney/Presentation/Model/Menu/Help/HelpMenu.cs
@@ -1,3 +1,4 @@
+using System;
 using System.Collections.Generic;
 using MoMoney.Presentation.Model.Menu.Help.commands;
 using MoMoney.Presentation.Presenters.Commands;
trunk/product/MyMoney/Presentation/Presenters/billing/dto/bill_information_dto.cs → trunk/product/MyMoney/Presentation/Presenters/billing/dto/BillInformationDto.cs
@@ -2,7 +2,7 @@ using System;
 
 namespace MoMoney.Presentation.Presenters.billing.dto
 {
-    public class bill_information_dto
+    public class BillInformationDTO
     {
         public string company_name { get; set; }
         public string the_amount_owed { get; set; }
trunk/product/MyMoney/Presentation/Presenters/billing/AddBillPaymentPresenter.cs
@@ -27,27 +27,16 @@ namespace MoMoney.Presentation.Presenters.billing
         public override void run()
         {
             view.attach_to(this);
-            pump.run<IEnumerable<ICompany>, IGetAllCompanysQuery>(view);
-            pump.run<IEnumerable<bill_information_dto>, IGetAllBillsQuery>(view);
-            //view.run(tasks.all_companys());
-            //view.run(tasks.all_bills().map_all_using(x => map_from(x)));
+            pump
+                .run<IEnumerable<ICompany>, IGetAllCompanysQuery>(view)
+                .run<IEnumerable<BillInformationDTO>, IGetAllBillsQuery>(view);
         }
 
         public void submit_bill_payment(AddNewBillDTO dto)
         {
-            tasks.save_a_new_bill_using(dto);
-            //view.run(tasks.all_bills().map_all_using(x => map_from(x)));
-            pump.run<IEnumerable<bill_information_dto>, IGetAllBillsQuery>(view);
+            pump
+                .run<ISaveNewBillCommand, AddNewBillDTO>(dto)
+                .run<IEnumerable<BillInformationDTO>, IGetAllBillsQuery>(view);
         }
-
-        //bill_information_dto map_from(IBill bill)
-        //{
-        //    return new bill_information_dto
-        //               {
-        //                   company_name = bill.company_to_pay.name,
-        //                   the_amount_owed = bill.the_amount_owed.ToString(),
-        //                   due_date = bill.due_date.to_date_time(),
-        //               };
-        //}
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Presentation/Presenters/billing/ViewAllBillsPresenter.cs
@@ -25,7 +25,7 @@ namespace MoMoney.Presentation.Presenters.billing
                 tasks
                     .all_bills()
                     .map_all_using(
-                    x => new bill_information_dto
+                    x => new BillInformationDTO
                              {
                                  company_name = x.company_to_pay.name,
                                  the_amount_owed = x.the_amount_owed.ToString(),
trunk/product/MyMoney/Presentation/Presenters/reporting/ReportPresenter.cs
@@ -29,9 +29,9 @@ namespace MoMoney.Presentation.Presenters.reporting
             view.display(report);
         }
 
-        bill_information_dto map_from(IBill x)
+        BillInformationDTO map_from(IBill x)
         {
-            return new bill_information_dto
+            return new BillInformationDTO
                        {
                            company_name = x.company_to_pay.name,
                            due_date = x.due_date.to_date_time(),
trunk/product/MyMoney/Presentation/Presenters/Startup/SplashScreenPresenter.cs
@@ -1,11 +1,10 @@
 using MoMoney.Infrastructure.Threading;
-using MoMoney.Presentation.Model.interaction;
 using MoMoney.Presentation.Views.Startup;
 using MoMoney.Utility.Core;
 
 namespace MoMoney.Presentation.Presenters.Startup
 {
-    public interface ISplashScreenPresenter : IDisposableCommand, ITimerClient, ICallback<notification_message>
+    public interface ISplashScreenPresenter : IDisposableCommand, ITimerClient
     {
     }
 
@@ -40,10 +39,5 @@ namespace MoMoney.Presentation.Presenters.Startup
         {
             current_state.update();
         }
-
-        public void run(notification_message item)
-        {
-            view.notify(item);
-        }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Presentation/Views/billing/AddBillPaymentView.cs
@@ -31,7 +31,7 @@ namespace MoMoney.Presentation.Views.billing
             ux_company_names.bind_to(companys);
         }
 
-        public void run(IEnumerable<bill_information_dto> bills)
+        public void run(IEnumerable<BillInformationDTO> bills)
         {
             ux_bil_payments_grid.DataSource = bills.databind();
         }
trunk/product/MyMoney/Presentation/Views/billing/IAddBillPaymentView.cs
@@ -10,7 +10,7 @@ namespace MoMoney.Presentation.Views.billing
     public interface IAddBillPaymentView : IDockedContentView,
                                            IView<IAddBillPaymentPresenter>,
                                            ICallback<IEnumerable<ICompany>>,
-                                           ICallback<IEnumerable<bill_information_dto>>
+                                           ICallback<IEnumerable<BillInformationDTO>>
     {
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Presentation/Views/billing/IViewAllBills.cs
@@ -6,6 +6,6 @@ namespace MoMoney.Presentation.Views.billing
 {
     public interface IViewAllBills : IDockedContentView
     {
-        void display(IEnumerable<bill_information_dto> bills);
+        void display(IEnumerable<BillInformationDTO> bills);
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Presentation/Views/billing/view_all_bills_report.cs
@@ -9,7 +9,7 @@ namespace MoMoney.Presentation.Views.billing
 {
     public interface IViewAllBillsReport : IReport
     {
-        void bind_to(IEnumerable<bill_information_dto> bills);
+        void bind_to(IEnumerable<BillInformationDTO> bills);
     }
 
     public partial class view_all_bills_report : ActiveReport3, IViewAllBillsReport
@@ -22,11 +22,11 @@ namespace MoMoney.Presentation.Views.billing
 
         public string name { get; private set; }
 
-        public void bind_to(IEnumerable<bill_information_dto> bills)
+        public void bind_to(IEnumerable<BillInformationDTO> bills)
         {
-            ux_company_name.bind_to<bill_information_dto, string>(x => x.company_name);
-            ux_amount.bind_to<bill_information_dto, string>(x => x.the_amount_owed);
-            ux_due_date.bind_to<bill_information_dto, DateTime>(x => x.due_date);
+            ux_company_name.bind_to<BillInformationDTO, string>(x => x.company_name);
+            ux_amount.bind_to<BillInformationDTO, string>(x => x.the_amount_owed);
+            ux_due_date.bind_to<BillInformationDTO, DateTime>(x => x.due_date);
             DataSource = bills.databind();
         }
     }
trunk/product/MyMoney/Presentation/Views/billing/ViewAllBills.cs
@@ -13,7 +13,7 @@ namespace MoMoney.Presentation.Views.billing
             titled("View Bills");
         }
 
-        public void display(IEnumerable<bill_information_dto> bills)
+        public void display(IEnumerable<BillInformationDTO> bills)
         {
             ux_bills.DataSource = bills.ToList();
         }
trunk/product/MyMoney/Presentation/Views/core/ApplicationDockedWindow.cs
@@ -67,16 +67,20 @@ namespace MoMoney.Presentation.Views.core
             using (new SuspendLayout(panel))
             {
                 if (window_is_already_contained_in(panel)) remove_from(panel);
-                Show(panel);
-                DockState = dock_state;
+                //else
+                {
+                    Show(panel);
+                    DockState = dock_state;
+                }
             }
         }
 
-        public void remove_from(DockPanel panel)
+        void remove_from(DockPanel panel)
         {
             using (new SuspendLayout(panel))
             {
                 var panel_to_remove = get_window_from(panel);
+                //panel_to_remove.DockHandler.Activate();
                 panel_to_remove.DockHandler.Close();
                 panel_to_remove.DockHandler.Dispose();
             }
@@ -97,20 +101,12 @@ namespace MoMoney.Presentation.Views.core
             return x.DockHandler.TabText.Equals(TabText);
         }
 
-        //protected void on_ui_thread(Action action)
-        //{
-        //    //if (InvokeRequired) BeginInvoke(action);
-        //    //else action();
-
-        //    action();
-        //}
-
-        Control adapt(ToolTip item)
+        Control adapt(IDisposable item)
         {
             return new ControlAdapter(item);
         }
 
-        internal class ControlAdapter : Control
+        class ControlAdapter : Control
         {
             readonly IDisposable item;
 
trunk/product/MyMoney/Presentation/Views/core/ApplicationWindow.cs
@@ -50,19 +50,12 @@ namespace MoMoney.Presentation.Views.core
             return this;
         }
 
-        protected void on_ui_thread(Action action)
-        {
-            //if (InvokeRequired) BeginInvoke(action);
-            //else action();
-            action();
-        }
-
-        Control adapt(ToolTip item)
+        Control adapt(IDisposable item)
         {
             return new ControlAdapter(item);
         }
 
-        internal class ControlAdapter : Control
+        class ControlAdapter : Control
         {
             readonly IDisposable item;
 
trunk/product/MyMoney/Presentation/Views/dialogs/SaveChangesView.cs
@@ -1,17 +1,25 @@
 using System;
+using System.ComponentModel;
 using System.Windows.Forms;
 using MoMoney.Presentation.Model.Menu.File.Commands;
 using MoMoney.Presentation.Resources;
 using MoMoney.Presentation.Views.core;
+using MoMoney.Presentation.Views.updates;
 
 namespace MoMoney.Presentation.Views.dialogs
 {
     public partial class SaveChangesView : ApplicationWindow, ISaveChangesView
     {
+        readonly IWin32Window window;
         bool can_be_closed;
+        ControlAction<EventArgs> save_action = x => { };
+        ControlAction<EventArgs> do_not_save_action = x => { };
+        ControlAction<EventArgs> cancel_action = x => { };
+        ControlAction<CancelEventArgs> closing_action = x => { };
 
-        public SaveChangesView()
+        public SaveChangesView(IWin32Window window)
         {
+            this.window = window;
             InitializeComponent();
             ux_image.Image = ApplicationImages.Splash;
             ux_image.SizeMode = PictureBoxSizeMode.StretchImage;
@@ -20,19 +28,25 @@ namespace MoMoney.Presentation.Views.dialogs
                 .create_tool_tip_for("Save", "Save the document, and then close it.", save_button)
                 .create_tool_tip_for("Don't Save", "Discard any unsaved changes.", do_not_save_button)
                 .create_tool_tip_for("Cancel", "Go back.", cancel_button);
+
+            save_button.Click += (sender, e) => save_action(e);
+            do_not_save_button.Click += (sender, e) => do_not_save_action(e);
+            cancel_button.Click += (sender, e) => cancel_action(e);
+            Closing += (sender, e) => closing_action(e);
         }
 
         public void attach_to(ISaveChangesPresenter presenter)
         {
-            save_button.Click += (sender, e) => execute(presenter.save);
-            do_not_save_button.Click += (sender, e) => execute(presenter.dont_save);
-            cancel_button.Click += (sender, e) => execute(presenter.cancel);
-            Closing += (sender, e) => { if (!can_be_closed) presenter.cancel(); };
+            can_be_closed = false;
+            save_action = x => { execute(presenter.save); };
+            do_not_save_action = x => { execute(presenter.dont_save); };
+            cancel_action = x => { execute(presenter.cancel); };
+            closing_action = x => { if (!can_be_closed) presenter.cancel(); };
         }
 
         public void prompt_user_to_save()
         {
-            ShowDialog();
+            ShowDialog(window);
         }
 
         void execute(Action action)
trunk/product/MyMoney/Presentation/Views/dialogs/select_file_to_open_dialog.cs → trunk/product/MyMoney/Presentation/Views/dialogs/SelectFileToOpenDialog.cs
@@ -8,19 +8,22 @@ namespace MoMoney.Presentation.Views.dialogs
         IFile tell_me_the_path_to_the_file();
     }
 
-    public class select_file_to_open_dialog : ISelectFileToOpenDialog
+    public class SelectFileToOpenDialog : ISelectFileToOpenDialog
     {
-        private readonly FileDialog dialog;
+        readonly IWin32Window window;
+        readonly FileDialog dialog;
 
-        public select_file_to_open_dialog()
+        public SelectFileToOpenDialog(IWin32Window window)
         {
+            this.window = window;
             dialog = new OpenFileDialog {Filter = "My Money Files (*.mo)|*.mo"};
         }
 
         public IFile tell_me_the_path_to_the_file()
         {
-            var result = dialog.ShowDialog();
-            var path_to_the_file = (ApplicationFile) (result.Equals(DialogResult.Cancel) ? string.Empty : dialog.FileName);
+            var result = dialog.ShowDialog(window);
+            var path_to_the_file =
+                (ApplicationFile) (result.Equals(DialogResult.Cancel) ? string.Empty : dialog.FileName);
             dialog.Dispose();
             return path_to_the_file;
         }
trunk/product/MyMoney/Presentation/Views/dialogs/SelectFileToSaveToDialog.cs
@@ -10,16 +10,18 @@ namespace MoMoney.Presentation.Views.dialogs
 
     public class SelectFileToSaveToDialog : ISelectFileToSaveToDialog
     {
-        private readonly FileDialog dialog;
+        readonly FileDialog dialog;
+        readonly IWin32Window window;
 
-        public SelectFileToSaveToDialog()
+        public SelectFileToSaveToDialog(IWin32Window window)
         {
             dialog = new SaveFileDialog {Filter = "My Money Files (*.mo)|*.mo"};
+            this.window = window;
         }
 
         public IFile tell_me_the_path_to_the_file()
         {
-            var result = dialog.ShowDialog();
+            var result = dialog.ShowDialog(window);
             var the_path = (ApplicationFile) (result == DialogResult.Cancel ? string.Empty : dialog.FileName);
             dialog.Dispose();
             return the_path;
trunk/product/MyMoney/Presentation/Views/income/AddNewIncomeView.cs
@@ -1,3 +1,4 @@
+using System;
 using System.Collections.Generic;
 using System.Text;
 using System.Windows.Forms;
@@ -7,21 +8,25 @@ using MoMoney.Presentation.Model.interaction;
 using MoMoney.Presentation.Presenters.income;
 using MoMoney.Presentation.Presenters.income.dto;
 using MoMoney.Presentation.Views.core;
+using MoMoney.Presentation.Views.updates;
 using MoMoney.Utility.Extensions;
 
 namespace MoMoney.Presentation.Views.income
 {
     public partial class AddNewIncomeView : ApplicationDockedWindow, IAddNewIncomeView
     {
+        ControlAction<EventArgs> submit_button = x => { };
+
         public AddNewIncomeView()
         {
             InitializeComponent();
             titled("Add Income");
+            ux_submit_button.Click += (sender, e) => submit_button(e);
         }
 
         public void attach_to(IAddNewIncomePresenter presenter)
         {
-            ux_submit_button.Click += (sender, e) => presenter.submit_new(create_income());
+            submit_button = x => presenter.submit_new(create_income());
         }
 
         public void display(IEnumerable<ICompany> companies)
trunk/product/MyMoney/Presentation/Views/Shell/ApplicationShell.cs
@@ -6,6 +6,7 @@ using System.Windows.Forms;
 using MoMoney.Presentation.Presenters.Shell;
 using MoMoney.Presentation.Views.core;
 using MoMoney.Presentation.Views.helpers;
+using MoMoney.Presentation.Views.updates;
 using MoMoney.Utility.Extensions;
 
 namespace MoMoney.Presentation.Views.Shell
@@ -14,6 +15,7 @@ namespace MoMoney.Presentation.Views.Shell
     public partial class ApplicationShell : ApplicationWindow, IShell
     {
         readonly IDictionary<string, IComponent> regions;
+        ControlAction<EventArgs> closed_action;
 
         public ApplicationShell()
         {
@@ -30,17 +32,18 @@ namespace MoMoney.Presentation.Views.Shell
                               {status_bar_label.GetType().FullName, status_bar_label},
                               {status_bar_progress_bar.GetType().FullName, status_bar_progress_bar}
                           };
+            Closed += (o, e) => closed_action(e);
         }
 
         protected override void OnLoad(EventArgs e)
         {
             base.OnLoad(e);
-            try_to_reduce_flickering();
+            try_to_reduce_flickering().top_most();
         }
 
         public void attach_to(IApplicationShellPresenter presenter)
         {
-            Closed += (sender, args) => presenter.shut_down();
+            closed_action = x => presenter.shut_down();
         }
 
         public void add(IDockedContentView view)
@@ -69,9 +72,7 @@ namespace MoMoney.Presentation.Views.Shell
         void ensure_that_the_region_exists<T>()
         {
             if (!regions.ContainsKey(typeof (T).FullName))
-            {
                 throw new Exception("Could not find region: {0}".formatted_using(typeof (T)));
-            }
         }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Presentation/Views/Shell/ApplicationShell.Designer.cs
@@ -117,6 +117,7 @@ namespace MoMoney.Presentation.Views.Shell {
             this.Controls.Add(this.ux_dock_panel);
             this.Controls.Add(this.ux_status_bar);
             this.Controls.Add(this.ux_main_menu_strip);
+            this.HelpButton = true;
             this.IsMdiContainer = true;
             this.MainMenuStrip = this.ux_main_menu_strip;
             this.Margin = new System.Windows.Forms.Padding(4);
trunk/product/MyMoney/Presentation/Views/Shell/UnhandledErrorView.cs
@@ -3,11 +3,15 @@ using System.Windows.Forms;
 using MoMoney.Presentation.Presenters.Shell;
 using MoMoney.Presentation.Resources;
 using MoMoney.Presentation.Views.core;
+using MoMoney.Presentation.Views.updates;
 
 namespace MoMoney.Presentation.Views.Shell
 {
     public partial class UnhandledErrorView : ApplicationWindow, IUnhandledErrorView
     {
+        ControlAction<EventArgs> close_action = x => { };
+        ControlAction<EventArgs> restart_action = x => { };
+
         public UnhandledErrorView()
         {
             InitializeComponent();
@@ -17,24 +21,21 @@ namespace MoMoney.Presentation.Views.Shell
                 .create_tool_tip_for("Ignore", "Ignore the error and continue working.", close_button)
                 .create_tool_tip_for("Restart", "Discard any unsaved changes and restart the application.",
                                      restart_button);
+
+            close_button.Click += (sender, args) => close_action(args);
+            restart_button.Click += (sender, args) => restart_action(args);
         }
 
         public void attach_to(IUnhandledErrorPresenter presenter)
         {
-            on_ui_thread(() =>
-                             {
-                                 close_button.Click += (sender, args) => Close();
-                                 restart_button.Click += (sender, args) => presenter.restart_application();
-                             });
+            close_action = x => Close();
+            restart_action = x => presenter.restart_application();
         }
 
         public void display(Exception exception)
         {
-            on_ui_thread(() =>
-                             {
-                                 ux_message.Text = exception.ToString();
-                                 ShowDialog();
-                             });
+            ux_message.Text = exception.ToString();
+            ShowDialog();
         }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Presentation/Views/Startup/ISplashScreenView.cs
@@ -1,5 +1,3 @@
-using MoMoney.Presentation.Model.interaction;
-
 namespace MoMoney.Presentation.Views.Startup
 {
     public interface ISplashScreenView
@@ -9,6 +7,5 @@ namespace MoMoney.Presentation.Views.Startup
         void decrement_the_opacity();
         void close_the_screen();
         void display();
-        void notify(notification_message message);
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Presentation/Views/Startup/SplashScreenView.cs
@@ -1,6 +1,5 @@
 using System;
 using System.Windows.Forms;
-using MoMoney.Presentation.Model.interaction;
 using MoMoney.Presentation.Resources;
 using MoMoney.Presentation.Views.core;
 
@@ -25,7 +24,7 @@ namespace MoMoney.Presentation.Views.Startup
 
         public void increment_the_opacity()
         {
-            on_ui_thread(() => { Opacity += 0.2; });
+            Opacity += 0.2;
         }
 
         public double current_opacity()
@@ -35,25 +34,18 @@ namespace MoMoney.Presentation.Views.Startup
 
         public void decrement_the_opacity()
         {
-            on_ui_thread(() => { Opacity -= .1; });
+            Opacity -= .1;
         }
 
         public void close_the_screen()
         {
-            on_ui_thread(() =>
-                             {
-                                 Close();
-                                 Dispose();
-                             });
+            Close();
+            Dispose();
         }
 
         public void display()
         {
-            on_ui_thread(Show);
-        }
-
-        public void notify(notification_message message)
-        {
+            Show();
         }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Presentation/Views/AddCompanyView.cs
@@ -1,3 +1,4 @@
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -9,12 +10,14 @@ using MoMoney.Presentation.Presenters;
 using MoMoney.Presentation.Presenters.billing.dto;
 using MoMoney.Presentation.Resources;
 using MoMoney.Presentation.Views.core;
+using MoMoney.Presentation.Views.updates;
 using MoMoney.Utility.Extensions;
 
 namespace MoMoney.Presentation.Views
 {
     public partial class AddCompanyView : ApplicationDockedWindow, IAddCompanyView
     {
+        ControlAction<EventArgs> submit_button = x => { };
         readonly RegisterNewCompany dto;
 
         public AddCompanyView()
@@ -23,22 +26,19 @@ namespace MoMoney.Presentation.Views
             titled("Add A Company");
             dto = new RegisterNewCompany();
 
-            initialize1();
-        }
-
-        void initialize1()
-        {
             listView1.View = View.LargeIcon;
             listView1.LargeImageList = new ImageList();
             ApplicationIcons.all().each(x => listView1.LargeImageList.Images.Add(x.name_of_the_icon, x));
             listView1.Columns.Add("Name");
+
+            ux_submit_button.Click += (x, y) => submit_button(y);
+            ux_cancel_button.Click += (x, y) => Close();
         }
 
         public void attach_to(IAddCompanyPresenter presenter)
         {
             ux_company_name.bind_to(dto, x => x.company_name);
-            ux_submit_button.Click += (x, y) => presenter.submit(dto);
-            ux_cancel_button.Click += (x, y) => Dispose();
+            submit_button = x => presenter.submit(dto);
         }
 
         public void run(IEnumerable<ICompany> companies)
@@ -46,7 +46,7 @@ namespace MoMoney.Presentation.Views
             ux_companys_listing.DataSource = companies.databind();
 
             listView1.Items.Clear();
-            listView1.Items.AddRange(companies.Select(x => new ListViewItem(x.name, 3)).ToArray());
+            listView1.Items.AddRange(companies.Select(x => new ListViewItem(x.name, 0)).ToArray());
         }
 
         public void notify(params notification_message[] messages)
trunk/product/MyMoney/Tasks/application/BillingTasks.cs
@@ -1,14 +1,11 @@
 using System.Collections.Generic;
 using MoMoney.Domain.accounting.billing;
-using MoMoney.Domain.Core;
 using MoMoney.Domain.repositories;
-using MoMoney.Presentation.Presenters.billing.dto;
 
 namespace MoMoney.Tasks.application
 {
     public interface IBillingTasks
     {
-        void save_a_new_bill_using(AddNewBillDTO dto);
         IEnumerable<IBill> all_bills();
         IEnumerable<ICompany> all_companys();
     }
@@ -17,20 +14,11 @@ namespace MoMoney.Tasks.application
     {
         readonly IBillRepository bills;
         readonly ICompanyRepository companys;
-        readonly ICustomerTasks tasks;
 
-        public BillingTasks(IBillRepository bills, ICompanyRepository companys, ICustomerTasks tasks)
+        public BillingTasks(IBillRepository bills, ICompanyRepository companys)
         {
             this.bills = bills;
             this.companys = companys;
-            this.tasks = tasks;
-        }
-
-        public void save_a_new_bill_using(AddNewBillDTO dto)
-        {
-            var company = companys.find_company_named(dto.company_name);
-            var customer = tasks.get_the_current_customer();
-            company.issue_bill_to(customer, dto.due_date, dto.total.as_money());
         }
 
         public IEnumerable<IBill> all_bills()
trunk/product/MyMoney/Tasks/application/GetAllBillsQuery.cs
@@ -1,32 +1,33 @@
 using System.Collections.Generic;
 using MoMoney.Domain.accounting.billing;
+using MoMoney.Domain.repositories;
 using MoMoney.Presentation.Presenters.billing.dto;
 using MoMoney.Utility.Core;
 using MoMoney.Utility.Extensions;
 
 namespace MoMoney.Tasks.application
 {
-    public interface IGetAllBillsQuery : IQuery<IEnumerable<bill_information_dto>>
+    public interface IGetAllBillsQuery : IQuery<IEnumerable<BillInformationDTO>>
     {
     }
 
     public class GetAllBillsQuery : IGetAllBillsQuery
     {
-        readonly IBillingTasks tasks;
+        readonly IBillRepository bills;
 
-        public GetAllBillsQuery(IBillingTasks tasks)
+        public GetAllBillsQuery(IBillRepository bills)
         {
-            this.tasks = tasks;
+            this.bills = bills;
         }
 
-        public IEnumerable<bill_information_dto> fetch()
+        public IEnumerable<BillInformationDTO> fetch()
         {
-            return tasks.all_bills().map_all_using(x => map_from(x));
+            return bills.all().map_all_using(x => map_from(x));
         }
 
-        bill_information_dto map_from(IBill bill)
+        BillInformationDTO map_from(IBill bill)
         {
-            return new bill_information_dto
+            return new BillInformationDTO
                        {
                            company_name = bill.company_to_pay.name,
                            the_amount_owed = bill.the_amount_owed.ToString(),
trunk/product/MyMoney/Tasks/application/SaveNewBillCommand.cs
@@ -0,0 +1,34 @@
+using MoMoney.Domain.Core;
+using MoMoney.Domain.repositories;
+using MoMoney.Presentation.Presenters.billing.dto;
+using MoMoney.Utility.Core;
+
+namespace MoMoney.Tasks.application
+{
+    public interface ISaveNewBillCommand : IParameterizedCommand<AddNewBillDTO>
+    {
+    }
+
+    public class SaveNewBillCommand : ISaveNewBillCommand
+    {
+        readonly ICompanyRepository companys;
+        readonly ICustomerTasks tasks;
+
+        public SaveNewBillCommand(ICompanyRepository companys, ICustomerTasks tasks)
+        {
+            this.companys = companys;
+            this.tasks = tasks;
+        }
+
+        public void run(AddNewBillDTO item)
+        {
+            companys
+                .find_company_named(item.company_name)
+                .issue_bill_to(
+                tasks.get_the_current_customer(),
+                item.due_date,
+                item.total.as_money()
+                );
+        }
+    }
+}
\ No newline at end of file
trunk/product/MyMoney/MyMoney.csproj
@@ -403,7 +403,7 @@
     <Compile Include="Presentation\Presenters\AddCompanyPresenter.cs" />
     <Compile Include="Presentation\Presenters\AddCompanyPresenterSpecs.cs" />
     <Compile Include="Presentation\Presenters\billing\dto\AddNewBillDTO.cs" />
-    <Compile Include="Presentation\Presenters\billing\dto\bill_information_dto.cs" />
+    <Compile Include="Presentation\Presenters\billing\dto\BillInformationDto.cs" />
     <Compile Include="Presentation\Presenters\billing\dto\RegisterNewCompany.cs" />
     <Compile Include="Presentation\Presenters\billing\ViewAllBillsPresenter.cs" />
     <Compile Include="Presentation\Presenters\Commands\RestartCommand.cs" />
@@ -515,7 +515,7 @@
     </Compile>
     <Compile Include="Presentation\Views\core\IDockedContentView.cs" />
     <Compile Include="Presentation\Views\core\IView.cs" />
-    <Compile Include="Presentation\Views\dialogs\select_file_to_open_dialog.cs" />
+    <Compile Include="Presentation\Views\dialogs\SelectFileToOpenDialog.cs" />
     <Compile Include="Presentation\Views\dialogs\SelectFileToSaveToDialog.cs" />
     <Compile Include="Presentation\Views\income\AddNewIncomeView.cs">
       <SubType>Form</SubType>
@@ -531,7 +531,7 @@
     <Compile Include="Presentation\Views\income\ViewAllIncome.Designer.cs">
       <DependentUpon>ViewAllIncome.cs</DependentUpon>
     </Compile>
-    <Compile Include="Presentation\Databindings\listbox_extensions.cs" />
+    <Compile Include="Presentation\Databindings\ListboxExtensions.cs" />
     <Compile Include="Presentation\Views\Navigation\IMainMenuView.cs" />
     <Compile Include="Presentation\Views\Navigation\MainMenuView.cs">
       <SubType>Form</SubType>
@@ -604,6 +604,7 @@
     <Compile Include="Tasks\application\GetAllCompanysQuery.cs" />
     <Compile Include="Tasks\application\IncomeTasks.cs" />
     <Compile Include="Tasks\application\RegisterNewCompanyCommand.cs" />
+    <Compile Include="Tasks\application\SaveNewBillCommand.cs" />
     <Compile Include="Tasks\infrastructure\core\CommandPump.cs" />
     <Compile Include="Tasks\infrastructure\core\ICallbackCommand.cs" />
     <Compile Include="Tasks\infrastructure\LogFileTasks.cs" />