using System;
using System.Windows;
namespace MediaBrowser.UI.Controls
{
///
/// Class BaseModalWindow
///
public class BaseModalWindow : BaseWindow
{
///
/// Shows the modal.
///
/// The owner.
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();
}
///
/// Called when [browser back].
///
protected override void OnBrowserBack()
{
base.OnBrowserBack();
CloseModal();
}
///
/// Raises the event. This method is invoked whenever is set to true internally.
///
/// The that contains the event data.
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
DataContext = this;
}
///
/// Closes the modal.
///
protected virtual void CloseModal()
{
Close();
}
}
}