Commit 5e682aa

mokhan <mokhan@ce5e1baf-6525-42e4-a1b2-857ea38da20a>
2009-03-13 21:05:55
added error checking around region manager.
git-svn-id: https://svn.xp-dev.com/svn/mokhan-mo.money@70 ce5e1baf-6525-42e4-a1b2-857ea38da20a
1 parent 07dec6a
Changed files (1)
trunk
product
MyMoney
Presentation
trunk/product/MyMoney/Presentation/Views/Shell/ApplicationShell.cs
@@ -31,9 +31,11 @@ namespace MoMoney.Presentation.Views.Shell
 
         public void region<T>(Action<T> action) where T : Control
         {
+            ensure_that_the_region_exists<T>();
             on_ui_thread(() => action(regions[typeof (T).FullName].downcast_to<T>()));
         }
 
+
         public void close_the_active_window()
         {
             on_ui_thread(() => ux_dock_panel.ActiveDocument.DockHandler.Close());
@@ -58,5 +60,12 @@ namespace MoMoney.Presentation.Views.Shell
         //                         ux_main_menu_strip.Items.Clear();
         //                     });
         //}
+        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