diff options
Diffstat (limited to 'win/C#/HandBrakeWPF/Services')
-rw-r--r-- | win/C#/HandBrakeWPF/Services/MefBootstrapper.cs | 21 | ||||
-rw-r--r-- | win/C#/HandBrakeWPF/Services/WindowManager.cs | 40 |
2 files changed, 21 insertions, 40 deletions
diff --git a/win/C#/HandBrakeWPF/Services/MefBootstrapper.cs b/win/C#/HandBrakeWPF/Services/MefBootstrapper.cs new file mode 100644 index 000000000..bd05356c0 --- /dev/null +++ b/win/C#/HandBrakeWPF/Services/MefBootstrapper.cs @@ -0,0 +1,21 @@ +namespace HandBrakeWPF.Services
+{
+ using System.ComponentModel.Composition.Hosting;
+ using System.Linq;
+
+ using Caliburn.Core.InversionOfControl;
+ using Caliburn.MEF;
+ using Caliburn.PresentationFramework.ApplicationModel;
+
+ using HandBrakeWPF.ViewModels.Interfaces;
+
+ public class MefBootstrapper : Bootstrapper<IMainViewModel>
+ {
+ protected override IServiceLocator CreateContainer()
+ {
+ var container = new CompositionContainer(new AggregateCatalog(SelectAssemblies().Select(x => new AssemblyCatalog(x))));
+
+ return new MEFAdapter(container);
+ }
+ }
+}
\ No newline at end of file diff --git a/win/C#/HandBrakeWPF/Services/WindowManager.cs b/win/C#/HandBrakeWPF/Services/WindowManager.cs deleted file mode 100644 index 903597bd4..000000000 --- a/win/C#/HandBrakeWPF/Services/WindowManager.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace HandBrakeWPF.Services
-{
- using System;
- using System.Windows;
-
- using Caliburn.PresentationFramework.ApplicationModel;
-
- public class WindowManager : DefaultWindowManager, IWindowManager
- {
-
- public WindowManager(IViewStrategy viewStrategy, IBinder binder)
-
- : base(viewStrategy, binder)
- {
- }
-
- //Display a view in a dialog (modal) window
- public new bool? ShowDialog(object rootModel, object context, Action<ISubordinate, Action> handleShutdownModel)
- {
- var window = base.CreateWindow(rootModel, true, context, handleShutdownModel);
- window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
- window.WindowStyle = WindowStyle.ToolWindow;
- window.ResizeMode = ResizeMode.NoResize;
- window.Title = ((IPresenter)rootModel).DisplayName;
- return window.ShowDialog();
- }
-
- //Display a view in a popup (non-modal) window
- public new void Show(object rootModel, object context, Action<ISubordinate, Action> handleShutdownModel)
- {
- var window = base.CreateWindow(rootModel, false, context, handleShutdownModel);
- window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
- window.Title = ((IPresenter)rootModel).DisplayName;
- window.ResizeMode = ResizeMode.NoResize;
- window.Show();
- }
-
- }
-
-}
|