summaryrefslogtreecommitdiffstats
path: root/win/C#/HandBrakeWPF/Services/WindowManager.cs
blob: 903597bd455a926d245716dfd1382bb93de03399 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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();
        }

    }

}