Commit 600cd9f

mokhan <mokhan@ce5e1baf-6525-42e4-a1b2-857ea38da20a>
2009-03-08 07:10:54
got the app running again.
git-svn-id: https://svn.xp-dev.com/svn/mokhan-mo.money@60 ce5e1baf-6525-42e4-a1b2-857ea38da20a
1 parent a8a9eb2
trunk/product/MyMoney/Infrastructure/Container/Windsor/WindsorDependencyRegistry.cs
@@ -56,11 +56,11 @@ namespace MoMoney.Infrastructure.Container.Windsor
             return "{0}-{1}".formatted_using(interface_type.FullName, implementation_type.FullName);
         }
 
-        public void proxy<T>(IConfiguration<IProxyBuilder<T>> configuration)
+        public void proxy<T>(IConfiguration<IProxyBuilder<T>> configuration, Func<T> target)
         {
             var builder = new ProxyBuilder<T>();
             configuration.configure(builder);
-            singleton(builder.create_proxy_for(() => underlying_container.Resolve<T>()));
+            singleton(builder.create_proxy_for(target));
         }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Infrastructure/interceptors/SynchronizedInterceptor.cs
@@ -9,11 +9,11 @@ namespace MoMoney.Infrastructure.interceptors
     {
     }
 
-    public class SynchronizedInterceptor : ISynchronizedInterceptor
+    public class SynchronizedInterceptor<T> : ISynchronizedInterceptor where T : ISynchronizeInvoke
     {
         public void Intercept(IInvocation invocation)
         {
-            var target = invocation.InvocationTarget.downcast_to<ISynchronizeInvoke>();
+            var target = invocation.InvocationTarget.downcast_to<T>();
             target.BeginInvoke(do_it(invocation.Proceed), new object[] {});
         }
 
trunk/product/MyMoney/Presentation/Views/billing/add_bill_payment.cs
@@ -1,7 +1,5 @@
 using System.Collections.Generic;
-using Castle.Core;
 using MoMoney.Domain.accounting.billing;
-using MoMoney.Infrastructure.interceptors;
 using MoMoney.Presentation.Presenters.billing;
 using MoMoney.Presentation.Presenters.billing.dto;
 using MoMoney.Presentation.Views.core;
@@ -9,7 +7,6 @@ using MoMoney.Utility.Extensions;
 
 namespace MoMoney.Presentation.Views.billing
 {
-    [Interceptor(typeof (ISynchronizedInterceptor))]
     public partial class add_bill_payment : ApplicationDockedWindow, IAddBillPaymentView
     {
         public add_bill_payment()
trunk/product/MyMoney/Presentation/Views/billing/view_all_bills.cs
@@ -1,13 +1,10 @@
 using System.Collections.Generic;
 using System.Linq;
-using Castle.Core;
-using MoMoney.Infrastructure.interceptors;
 using MoMoney.Presentation.Presenters.billing.dto;
 using MoMoney.Presentation.Views.core;
 
 namespace MoMoney.Presentation.Views.billing
 {
-    [Interceptor(typeof (ISynchronizedInterceptor))]
     public partial class view_all_bills : ApplicationDockedWindow, IViewAllBills
     {
         public view_all_bills()
trunk/product/MyMoney/Presentation/Views/dialogs/SaveChangesView.cs
@@ -1,8 +1,6 @@
 using System;
 using System.Windows.Forms;
-using Castle.Core;
 using JetBrains.Annotations;
-using MoMoney.Infrastructure.interceptors;
 using MoMoney.Presentation.Model.Menu.File.Commands;
 using MoMoney.Presentation.Resources;
 using MoMoney.Presentation.Views.core;
@@ -10,7 +8,6 @@ using MoMoney.Presentation.Views.core;
 namespace MoMoney.Presentation.Views.dialogs
 {
     [UsedImplicitly]
-    [Interceptor(typeof (ISynchronizedInterceptor))]
     public partial class SaveChangesView : ApplicationWindow, ISaveChangesView
     {
         bool can_be_closed;
trunk/product/MyMoney/Presentation/Views/income/AddNewIncomeView.cs
@@ -1,9 +1,7 @@
 using System.Collections.Generic;
 using System.Text;
 using System.Windows.Forms;
-using Castle.Core;
 using MoMoney.Domain.accounting.billing;
-using MoMoney.Infrastructure.interceptors;
 using MoMoney.Presentation.Model.interaction;
 using MoMoney.Presentation.Presenters.income;
 using MoMoney.Presentation.Presenters.income.dto;
@@ -12,7 +10,6 @@ using MoMoney.Utility.Extensions;
 
 namespace MoMoney.Presentation.Views.income
 {
-    [Interceptor(typeof (ISynchronizedInterceptor))]
     public partial class AddNewIncomeView : ApplicationDockedWindow, IAddNewIncomeView
     {
         public AddNewIncomeView()
trunk/product/MyMoney/Presentation/Views/income/ViewAllIncome.cs
@@ -1,13 +1,10 @@
 using System.Collections.Generic;
-using Castle.Core;
-using MoMoney.Infrastructure.interceptors;
 using MoMoney.Presentation.Presenters.income.dto;
 using MoMoney.Presentation.Views.core;
 using MoMoney.Utility.Extensions;
 
 namespace MoMoney.Presentation.Views.income
 {
-    [Interceptor(typeof (ISynchronizedInterceptor))]
     public partial class ViewAllIncome : ApplicationDockedWindow, IViewIncomeHistory
     {
         public ViewAllIncome()
trunk/product/MyMoney/Presentation/Views/Menu/Help/AboutTheApplicationView.cs
@@ -8,7 +8,6 @@ using MoMoney.Utility.Extensions;
 
 namespace MoMoney.Presentation.Views.Menu.Help
 {
-    [Interceptor(typeof (ISynchronizedInterceptor))]
     public partial class AboutTheApplicationView : ApplicationWindow, IAboutApplicationView
     {
         public AboutTheApplicationView()
trunk/product/MyMoney/Presentation/Views/Navigation/MainMenuView.cs
@@ -1,5 +1,3 @@
-using Castle.Core;
-using MoMoney.Infrastructure.interceptors;
 using MoMoney.Presentation.Resources;
 using MoMoney.Presentation.Views.core;
 using MoMoney.Presentation.Views.Shell;
@@ -8,7 +6,6 @@ using XPExplorerBar;
 
 namespace MoMoney.Presentation.Views.Navigation
 {
-    [Interceptor(typeof (ISynchronizedInterceptor))]
     public partial class MainMenuView : ApplicationDockedWindow, IMainMenuView
     {
         readonly IShell shell;
trunk/product/MyMoney/Presentation/Views/Navigation/NavigationView.cs
@@ -1,6 +1,4 @@
 using System.Windows.Forms;
-using Castle.Core;
-using MoMoney.Infrastructure.interceptors;
 using MoMoney.Presentation.Model.Navigation;
 using MoMoney.Presentation.Resources;
 using MoMoney.Presentation.Views.core;
@@ -10,7 +8,6 @@ using WeifenLuo.WinFormsUI.Docking;
 
 namespace MoMoney.Presentation.Views.Navigation
 {
-    [Interceptor(typeof (ISynchronizedInterceptor))]
     public partial class NavigationView : ApplicationDockedWindow, INavigationView
     {
         readonly IShell shell;
trunk/product/MyMoney/Presentation/Views/Shell/ApplicationShell.cs
@@ -1,14 +1,11 @@
 using System.ComponentModel.Composition;
 using System.Windows.Forms;
-using Castle.Core;
-using MoMoney.Infrastructure.interceptors;
 using MoMoney.Presentation.Resources;
 using MoMoney.Presentation.Views.core;
 
 namespace MoMoney.Presentation.Views.Shell
 {
     [Export(typeof (IShell))]
-    //[Interceptor(typeof (ISynchronizedInterceptor))]
     public partial class ApplicationShell : ApplicationWindow, IShell
     {
         public ApplicationShell()
trunk/product/MyMoney/Presentation/Views/Shell/NotificationIconView.cs
@@ -1,6 +1,5 @@
 using System.Windows.Forms;
 using Castle.Core;
-using MoMoney.Infrastructure.interceptors;
 using MoMoney.Presentation.Model.Menu;
 using MoMoney.Presentation.Model.Menu.File;
 using MoMoney.Presentation.Model.Menu.Help;
@@ -10,14 +9,13 @@ using MoMoney.Presentation.Resources;
 namespace MoMoney.Presentation.Views.Shell
 {
     [Singleton]
-    [Interceptor(typeof (ISynchronizedInterceptor))]
     public class NotificationIconView : INotificationIconView
     {
-        private NotifyIcon ux_notification_icon;
-        private readonly IFileMenu file_menu;
-        private readonly IWindowMenu window_menu;
-        private readonly IHelpMenu help_menu;
-        private bool hooked_up;
+        NotifyIcon ux_notification_icon;
+        readonly IFileMenu file_menu;
+        readonly IWindowMenu window_menu;
+        readonly IHelpMenu help_menu;
+        bool hooked_up;
 
         public NotificationIconView(IFileMenu file_menu, IWindowMenu window_menu, IHelpMenu help_menu)
         {
@@ -64,7 +62,7 @@ namespace MoMoney.Presentation.Views.Shell
             ux_notification_icon.ShowBalloonTip(100, message, message, ToolTipIcon.Info);
         }
 
-        private MenuItem map_from(ISubMenu item)
+        MenuItem map_from(ISubMenu item)
         {
             var toolStripMenuItem = new MenuItem(item.name);
             foreach (var menuItem in item.all_menu_items())
trunk/product/MyMoney/Presentation/Views/Shell/StatusBarView.cs
@@ -1,10 +1,7 @@
-using Castle.Core;
-using MoMoney.Infrastructure.interceptors;
 using MoMoney.Presentation.Resources;
 
 namespace MoMoney.Presentation.Views.Shell
 {
-    [Interceptor(typeof (ISynchronizedInterceptor))]
     public class StatusBarView : IStatusBarView
     {
         readonly IShell shell;
trunk/product/MyMoney/Presentation/Views/Startup/SplashScreenView.cs
@@ -1,12 +1,9 @@
 using System.Windows.Forms;
-using Castle.Core;
-using MoMoney.Infrastructure.interceptors;
 using MoMoney.Presentation.Resources;
 using MoMoney.Presentation.Views.core;
 
 namespace MoMoney.Presentation.Views.Startup
 {
-    [Interceptor(typeof (ISynchronizedInterceptor))]
     public partial class SplashScreenView : ApplicationWindow, ISplashScreenView
     {
         public SplashScreenView()
trunk/product/MyMoney/Presentation/Views/updates/CheckForUpdatesView.cs
@@ -1,7 +1,5 @@
 using System.Reflection;
 using System.Windows.Forms;
-using Castle.Core;
-using MoMoney.Infrastructure.interceptors;
 using MoMoney.Presentation.Model.updates;
 using MoMoney.Presentation.Presenters.updates;
 using MoMoney.Presentation.Resources;
@@ -9,7 +7,6 @@ using MoMoney.Presentation.Views.core;
 
 namespace MoMoney.Presentation.Views.updates
 {
-    [Interceptor(typeof (ISynchronizedInterceptor))]
     public partial class CheckForUpdatesView : ApplicationWindow, ICheckForUpdatesView
     {
         ICheckForUpdatesPresenter the_presenter;
trunk/product/MyMoney/Presentation/Views/AddCompanyView.cs
@@ -1,9 +1,7 @@
 using System.Collections.Generic;
 using System.Text;
 using System.Windows.Forms;
-using Castle.Core;
 using MoMoney.Domain.accounting.billing;
-using MoMoney.Infrastructure.interceptors;
 using MoMoney.Presentation.Databindings;
 using MoMoney.Presentation.Model.interaction;
 using MoMoney.Presentation.Presenters;
@@ -13,7 +11,6 @@ using MoMoney.Utility.Extensions;
 
 namespace MoMoney.Presentation.Views
 {
-    [Interceptor(typeof (ISynchronizedInterceptor))]
     public partial class AddCompanyView : ApplicationDockedWindow, IAddCompanyView
     {
         readonly register_new_company dto;
trunk/product/MyMoney/windows.ui/wire_up_the_views_in_to_the.cs
@@ -1,4 +1,7 @@
+using System.ComponentModel;
 using MoMoney.Infrastructure.Container.Windsor;
+using MoMoney.Infrastructure.interceptors;
+using MoMoney.Infrastructure.proxies;
 using MoMoney.Presentation.Context;
 using MoMoney.Presentation.Views;
 using MoMoney.Presentation.Views.billing;
@@ -25,6 +28,7 @@ namespace MoMoney.windows.ui
         public void run()
         {
             register.singleton<IShell, ApplicationShell>();
+            //register.proxy(new SynchronizedViewProxyConfiguration<IShell>(), () => new ApplicationShell());
             register.singleton<the_application_context, the_application_context>();
             register.transient<IAboutApplicationView, AboutTheApplicationView>();
             register.transient<ISplashScreenView, SplashScreenView>();
@@ -37,9 +41,16 @@ namespace MoMoney.windows.ui
             register.transient<IViewIncomeHistory, ViewAllIncome>();
             register.transient<ISaveChangesView, SaveChangesView>();
             register.transient<ICheckForUpdatesView, CheckForUpdatesView>();
-            register.transient<INotificationIconView, NotificationIconView>();
+            register.singleton<INotificationIconView, NotificationIconView>();
             register.transient<IStatusBarView, StatusBarView>();
-            //register.proxy<IStatusBarView>(;
+        }
+    }
+
+    internal class SynchronizedViewProxyConfiguration<T> : IConfiguration<IProxyBuilder<T>> where T : ISynchronizeInvoke
+    {
+        public void configure(IProxyBuilder<T> item)
+        {
+            item.add_interceptor<SynchronizedInterceptor<T>>();
         }
     }
 }
\ No newline at end of file