Commit e180343

mokhan <mokhan@ce5e1baf-6525-42e4-a1b2-857ea38da20a>
2009-02-27 18:14:59
-F
git-svn-id: https://svn.xp-dev.com/svn/mokhan-mo.money@26 ce5e1baf-6525-42e4-a1b2-857ea38da20a
1 parent 03d5a19
trunk/src/MyMoney/Presentation/Views/core/ApplicationWindow.cs
@@ -3,19 +3,30 @@ using MyMoney.Presentation.Resources;
 
 namespace MyMoney.Presentation.Views.core
 {
-    public partial class ApplicationWindow : Form
+    public interface IApplicationWindow : IView
     {
-        public ApplicationWindow(string title)
+        IApplicationWindow titled(string title);
+        IApplicationWindow create_tool_tip_for(string title, string caption, Control control);
+    }
+
+    public partial class ApplicationWindow : Form, IApplicationWindow
+    {
+        public ApplicationWindow()
         {
             InitializeComponent();
             Icon = ApplicationIcons.Application;
-            base.Text = "MoMoney - " + title;
         }
 
-        protected ApplicationWindow create_tool_tip_for(string title, string caption, Control control)
+        public IApplicationWindow create_tool_tip_for(string title, string caption, Control control)
         {
             new ToolTip {IsBalloon = true, ToolTipTitle = title}.SetToolTip(control, caption);
             return this;
         }
+
+        public IApplicationWindow titled(string title)
+        {
+            base.Text = "MoMoney - " + title;
+            return this;
+        }
     }
 }
\ No newline at end of file
trunk/src/MyMoney/Presentation/Views/core/IDockedContentView.cs
@@ -4,9 +4,8 @@ using WeifenLuo.WinFormsUI.Docking;
 
 namespace MyMoney.Presentation.Views.core
 {
-    public interface IDockedContentView : IDockContent, ISynchronizeInvoke, IDisposable
+    public interface IDockedContentView : IDockContent, IView
     {
-        string TabText { get; }
         void add_to(DockPanel panel);
     }
 }
\ No newline at end of file
trunk/src/MyMoney/Presentation/Views/core/IView.cs
@@ -1,8 +1,14 @@
+using System;
+using System.ComponentModel;
 using MyMoney.Presentation.Core;
 
 namespace MyMoney.Presentation.Views.core
 {
-    public interface IView<Presenter> where Presenter : IPresenter
+    public interface IView : ISynchronizeInvoke, IDisposable
+    {
+    }
+
+    public interface IView<Presenter> : IView where Presenter : IPresenter
     {
         void attach_to(Presenter presenter);
     }
trunk/src/MyMoney/Presentation/Views/dialogs/save_changes_view.cs
@@ -8,16 +8,18 @@ namespace MyMoney.Presentation.Views.dialogs
 {
     public partial class save_changes_view : ApplicationWindow, ISaveChangesView
     {
-        private bool can_be_closed;
+        bool can_be_closed;
 
-        public save_changes_view():base("Unsaved Changes")
+        public save_changes_view()
         {
             InitializeComponent();
             ux_image.Image = ApplicationImages.Splash;
             ux_image.SizeMode = PictureBoxSizeMode.StretchImage;
-            create_tool_tip_for("Save", "Save the document, and then close it.", ux_save_button);
-            create_tool_tip_for("Don't Save", "Discard the unsaved changes.", ux_do_not_save_button);
-            create_tool_tip_for("Cancel", "Go back.", ux_cancel_button);
+
+            titled("Unsaved Changes")
+                .create_tool_tip_for("Save", "Save the document, and then close it.", ux_save_button)
+                .create_tool_tip_for("Don't Save", "Discard the unsaved changes.", ux_do_not_save_button)
+                .create_tool_tip_for("Cancel", "Go back.", ux_cancel_button);
         }
 
 
@@ -34,7 +36,7 @@ namespace MyMoney.Presentation.Views.dialogs
             ShowDialog();
         }
 
-        private void execute(Action action)
+        void execute(Action action)
         {
             can_be_closed = true;
             Hide();
trunk/src/MyMoney/Presentation/Views/income/add_new_income_view.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
 using System.Text;
 using System.Windows.Forms;
 using MyMoney.Domain.accounting.billing;
trunk/src/MyMoney/Presentation/Views/Navigation/navigation_view.cs
@@ -21,10 +21,12 @@ namespace MyMoney.Presentation.Views.Navigation
 
         void initialize_the_ui()
         {
+            icon(ApplicationIcons.FileExplorer)
+                .cannot_be_closed()
+                .docked_to(DockState.DockLeft);
+
             uxNavigationTreeView.ImageList = new ImageList();
             ApplicationIcons.all().each(x => uxNavigationTreeView.ImageList.Images.Add(x.name_of_the_icon, x));
-            CloseButton = false;
-            Icon = ApplicationIcons.FileExplorer;
         }
 
         public void accept(INavigationTreeVisitor tree_view_visitor)
@@ -32,7 +34,6 @@ namespace MyMoney.Presentation.Views.Navigation
             uxNavigationTreeView.Nodes.Clear();
             tree_view_visitor.visit(uxNavigationTreeView);
             shell.add(this);
-            DockState = DockState.DockLeft;
         }
     }
 }
\ No newline at end of file
trunk/src/MyMoney/Presentation/Views/reporting/report_viewer.cs
@@ -17,7 +17,7 @@ namespace MyMoney.Presentation.Views.reporting
             var the_active_report = report.downcast_to<ActiveReport3>();
             the_active_report.Run();
             ux_report_viewer.Document = the_active_report.Document;
-            TabText = report.name;
+            titled(report.name);
         }
     }
 }
\ No newline at end of file
trunk/src/MyMoney/Presentation/Views/updates/check_for_updates.cs
@@ -9,14 +9,18 @@ namespace MyMoney.Presentation.Views.updates
 {
     public partial class check_for_updates : ApplicationWindow, ICheckForUpdatesView
     {
-        public check_for_updates() : base("Check For Updates")
+        ICheckForUpdatesPresenter the_presenter;
+
+        public check_for_updates()
         {
             InitializeComponent();
             ux_image.Image = ApplicationImages.Splash;
             ux_image.SizeMode = PictureBoxSizeMode.StretchImage;
-            create_tool_tip_for("Update", "Update the application, and then re-start it.", ux_update_button);
-            create_tool_tip_for("Don't Update", "Discard the latest version.", ux_dont_update_button);
-            create_tool_tip_for("Cancel", "Go back.", ux_cancel_button);
+
+            titled("Check For Updates")
+                .create_tool_tip_for("Update", "Update the application, and then re-start it.", ux_update_button)
+                .create_tool_tip_for("Don't Update", "Discard the latest version.", ux_dont_update_button)
+                .create_tool_tip_for("Cancel", "Go back.", ux_cancel_button);
         }
 
         public void attach_to(ICheckForUpdatesPresenter presenter)
@@ -24,6 +28,7 @@ namespace MyMoney.Presentation.Views.updates
             ux_update_button.Click += (sender, e) => presenter.begin_update();
             ux_dont_update_button.Click += (sender, e) => presenter.do_not_update();
             ux_cancel_button.Click += (sender, e) => presenter.cancel_update();
+            the_presenter = presenter;
         }
 
         public void display(ApplicationVersion information)
@@ -44,7 +49,8 @@ namespace MyMoney.Presentation.Views.updates
 
         public void update_complete()
         {
-            MessageBox.Show("update complete", "Complete");
+            MessageBox.Show("update complete, the application will now restart.", "Complete", MessageBoxButtons.OK);
+            the_presenter.restart();
         }
     }
 }
\ No newline at end of file