From 30aebf3d64ced80263c5e0c65eb3d7d063fd5cad Mon Sep 17 00:00:00 2001 From: Markus Ewald Date: Fri, 8 Feb 2019 06:19:33 +0000 Subject: [PATCH] Update to include the new message service and common dialog service git-svn-id: file:///srv/devel/repo-conversion/dumps/svni@3 d2e56fa2-650e-0410-a79f-9358c0239efd --- Source/MvvmModule.cs | 64 +++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/Source/MvvmModule.cs b/Source/MvvmModule.cs index 268143a..45ff203 100644 --- a/Source/MvvmModule.cs +++ b/Source/MvvmModule.cs @@ -25,42 +25,50 @@ using Ninject.Activation; using Ninject.Modules; using Nuclex.Windows.Forms.AutoBinding; +using Nuclex.Windows.Forms.CommonDialogs; +using Nuclex.Windows.Forms.Messages; namespace Nuclex.Windows.Forms.Ninject { - /// Sets up the service bindings for an MVVM-based WPF application - public class MvvmModule : NinjectModule { + /// Sets up the service bindings for an MVVM-based WPF application + public class MvvmModule : NinjectModule { - /// Called when the module is loaded into the kernel - public override void Load() { + /// Called when the module is loaded into the kernel + public override void Load() { - // The window manager keeps track of active windows and can figure out - // which window to display for a view model by its naming convention. - Kernel.Bind().To().InSingletonScope(); - Kernel.Bind().ToMethod(getWindowManager).InSingletonScope(); - Kernel.Bind().ToMethod(getWindowManager).InSingletonScope(); - Kernel.Bind().ToMethod(CreateAutoBinder).InSingletonScope(); + // The task dialog message service actually supports two interfaces + Kernel.Bind().To().InSingletonScope(); - } + // Use the common dialog manager to display file open, save or print dialogs + Kernel.Bind().To().InSingletonScope(); - /// Creates and initializd the auto view model binder - /// - /// Context containing environmental informations about the request and the kernel - /// - /// The view model auto binder that will be used by the application - protected virtual IAutoBinder CreateAutoBinder(IContext context) { - return new ConventionBinder(); - } + // The window manager keeps track of active windows and can figure out + // which window to display for a view model by its naming convention. + Kernel.Bind().To().InSingletonScope(); + Kernel.Bind().ToMethod(getWindowManager).InSingletonScope(); + Kernel.Bind().ToMethod(getWindowManager).InSingletonScope(); + Kernel.Bind().ToMethod(CreateAutoBinder).InSingletonScope(); - /// Retrieves the window manager from the kernel - /// - /// Context containing environmental informations about the request and the kernel - /// - /// The window manager registered to the kernel - private static WindowManager getWindowManager(IContext context) { - return context.Kernel.Get(); - } + } - } + /// Creates and initializd the auto view model binder + /// + /// Context containing environmental informations about the request and the kernel + /// + /// The view model auto binder that will be used by the application + protected virtual IAutoBinder CreateAutoBinder(IContext context) { + return new ConventionBinder(); + } + + /// Retrieves the window manager from the kernel + /// + /// Context containing environmental informations about the request and the kernel + /// + /// The window manager registered to the kernel + private static WindowManager getWindowManager(IContext context) { + return context.Kernel.Get(); + } + + } } // namespace Nuclex.Windows.Forms.Ninject