Commit 3dc96c3

mokhan <mokhan@ce5e1baf-6525-42e4-a1b2-857ea38da20a>
2009-05-11 20:21:44
separated iregionmanager interface from shell, and updated usages.
git-svn-id: https://svn.xp-dev.com/svn/mokhan-mo.money@212 ce5e1baf-6525-42e4-a1b2-857ea38da20a
1 parent 29fd729
trunk/product/MoMoney.Presentation/Presenters/Menu/ApplicationMenuPresenter.cs
@@ -13,9 +13,9 @@ namespace MoMoney.Presentation.Presenters.Menu
     public class ApplicationMenuPresenter : IApplicationMenuPresenter
     {
         readonly ISubMenuRegistry registry;
-        readonly IShell shell;
+        readonly IRegionManager shell;
 
-        public ApplicationMenuPresenter(ISubMenuRegistry registry, IShell shell)
+        public ApplicationMenuPresenter(ISubMenuRegistry registry, IRegionManager shell)
         {
             this.registry = registry;
             this.shell = shell;
trunk/product/MoMoney.Presentation/Presenters/Shell/ToolBarPresenter.cs
@@ -16,10 +16,10 @@ namespace MoMoney.Presentation.Presenters.Shell
 
     public class ToolBarPresenter : IToolbarPresenter
     {
-        readonly IShell shell;
+        readonly IRegionManager shell;
         readonly IProjectController project;
 
-        public ToolBarPresenter(IShell shell, IProjectController project)
+        public ToolBarPresenter(IRegionManager shell, IProjectController project)
         {
             this.shell = shell;
             this.project = project;
trunk/product/MoMoney.Presentation/Views/Core/ApplicationWindow.cs
@@ -60,7 +60,7 @@ namespace MoMoney.Presentation.Views.core
 
         public IApplicationWindow titled(string title)
         {
-            base.Text = "MoMoney - " + title;
+            base.Text = "MoMoney (BETA) - " + title;
             return this;
         }
 
trunk/product/MoMoney.Presentation/Views/Shell/IRegionManager.cs
@@ -0,0 +1,10 @@
+using System;
+using System.ComponentModel;
+
+namespace MoMoney.Presentation.Views.Shell
+{
+    public interface IRegionManager
+    {
+        void region<T>(Action<T> action) where T : IComponent;
+    }
+}
\ No newline at end of file
trunk/product/MoMoney.Presentation/Views/Shell/IShell.cs
@@ -1,4 +1,3 @@
-using System;
 using System.ComponentModel;
 using System.Windows.Forms;
 using MoMoney.Presentation.Presenters.Shell;
@@ -6,11 +5,11 @@ using MoMoney.Presentation.Views.Core;
 
 namespace MoMoney.Presentation.Views.Shell
 {
-    public interface IShell : IWin32Window, ISynchronizeInvoke, IContainerControl, IBindableComponent, IDropTarget
+    public interface IShell : IWin32Window, ISynchronizeInvoke, IContainerControl, IBindableComponent, IDropTarget,
+                              IRegionManager
     {
         void attach_to(IApplicationShellPresenter presenter);
         void add(IDockedContentView view);
-        void region<T>(Action<T> action) where T : IComponent;
         void close_the_active_window();
         void close_all_windows();
     }
trunk/product/MoMoney.Presentation/Views/Shell/NotificationIconView.cs
@@ -14,9 +14,9 @@ namespace MoMoney.Presentation.Views.Shell
         readonly IFileMenu file_menu;
         readonly IWindowMenu window_menu;
         readonly IHelpMenu help_menu;
-        readonly IShell shell;
+        readonly IRegionManager shell;
 
-        public NotificationIconView(IFileMenu file_menu, IWindowMenu window_menu, IHelpMenu help_menu, IShell shell)
+        public NotificationIconView(IFileMenu file_menu, IWindowMenu window_menu, IHelpMenu help_menu, IRegionManager shell)
         {
             this.file_menu = file_menu;
             this.shell = shell;
trunk/product/MoMoney.Presentation/Views/Shell/StatusBarView.cs
@@ -5,9 +5,9 @@ namespace MoMoney.Presentation.Views.Shell
 {
     public class StatusBarView : IStatusBarView
     {
-        readonly IShell shell;
+        readonly IRegionManager shell;
 
-        public StatusBarView(IShell shell)
+        public StatusBarView(IRegionManager shell)
         {
             this.shell = shell;
         }
trunk/product/MoMoney.Presentation/Views/Shell/TitleBar.cs
@@ -11,9 +11,9 @@ namespace MoMoney.Presentation.Views.Shell
 
     public class TitleBar : ITitleBar
     {
-        readonly IShell shell;
+        readonly IRegionManager shell;
 
-        public TitleBar(IShell shell)
+        public TitleBar(IRegionManager shell)
         {
             this.shell = shell;
         }
@@ -21,33 +21,24 @@ namespace MoMoney.Presentation.Views.Shell
         public void display(string title)
         {
             shell.region<Form>(x =>
-            {
-                if (x.Text.Contains("-"))
-                {
-                   x.Text =x.Text.Remove(x.Text.IndexOf("-") - 1);
-                }
-               x.Text =x.Text + " - " + title;
-            });
+                                   {
+                                       if (x.Text.Contains("-")) x.Text = x.Text.Remove(x.Text.IndexOf("-") - 1);
+                                       x.Text = x.Text + " - " + title;
+                                   });
         }
 
         public void append_asterik()
         {
             shell.region<Form>(x =>
-            {
-                if (x.Text.Contains("*"))
-                {
-                    return;
-                }
-                x.Text = x.Text + "*";
-            });
+                                   {
+                                       if (x.Text.Contains("*")) return;
+                                       x.Text = x.Text + "*";
+                                   });
         }
 
         public void remove_asterik()
         {
-            shell.region<Form>(x =>
-            {
-                x.Text = x.Text.Replace("*", "");
-            });
+            shell.region<Form>(x => { x.Text = x.Text.Replace("*", ""); });
         }
     }
 }
\ No newline at end of file
trunk/product/MoMoney.Presentation/MoMoney.Presentation.csproj
@@ -336,6 +336,7 @@
     <Compile Include="Views\Shell\IGettingStartedView.cs" />
     <Compile Include="Views\Shell\ILogFileView.cs" />
     <Compile Include="Views\Shell\INotificationIconView.cs" />
+    <Compile Include="Views\Shell\IRegionManager.cs" />
     <Compile Include="Views\Shell\IShell.cs" />
     <Compile Include="Views\Shell\IStatusBarView.cs" />
     <Compile Include="Views\Shell\IUnhandledErrorView.cs" />
trunk/product/MyMoney/boot/container/registration/wire_up_the_views_in_to_the.cs
@@ -29,6 +29,7 @@ namespace MoMoney.boot.container.registration
             register.singleton<IShell>(() => shell);
             register.singleton<IWin32Window>(() => shell);
             register.singleton<ISynchronizeInvoke>(() => shell);
+            register.singleton<IRegionManager>(() => shell);
             //register.proxy<IShell, SynchronizedConfiguration<IShell>>(() => shell);
             register.singleton(() => shell);
             register.transient<IAboutApplicationView, AboutTheApplicationView>();