blob: 90bd8114f618aaf3a51976a84a5ff0d3624f74d9 (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
using System;
using System.Windows;
namespace MediaBrowser.UI.Controls
{
/// <summary>
/// Class BaseModalWindow
/// </summary>
public class BaseModalWindow : BaseWindow
{
/// <summary>
/// Shows the modal.
/// </summary>
/// <param name="owner">The owner.</param>
public void ShowModal(Window owner)
{
WindowStyle = WindowStyle.None;
ResizeMode = ResizeMode.NoResize;
ShowInTaskbar = false;
WindowStartupLocation = WindowStartupLocation.Manual;
AllowsTransparency = true;
Width = owner.Width;
Height = owner.Height;
Top = owner.Top;
Left = owner.Left;
WindowState = owner.WindowState;
Owner = owner;
ShowDialog();
}
/// <summary>
/// Called when [browser back].
/// </summary>
protected override void OnBrowserBack()
{
base.OnBrowserBack();
CloseModal();
}
/// <summary>
/// Raises the <see cref="E:System.Windows.FrameworkElement.Initialized" /> event. This method is invoked whenever <see cref="P:System.Windows.FrameworkElement.IsInitialized" /> is set to true internally.
/// </summary>
/// <param name="e">The <see cref="T:System.Windows.RoutedEventArgs" /> that contains the event data.</param>
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
DataContext = this;
}
/// <summary>
/// Closes the modal.
/// </summary>
protected virtual void CloseModal()
{
Close();
}
}
}
|