From 767cdc1f6f6a63ce997fc9476911e2c361f9d402 Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Wed, 20 Feb 2013 20:33:05 -0500 Subject: Pushing missing changes --- MediaBrowser.UI.Controls/BaseModalWindow.cs | 62 +++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 MediaBrowser.UI.Controls/BaseModalWindow.cs (limited to 'MediaBrowser.UI.Controls/BaseModalWindow.cs') diff --git a/MediaBrowser.UI.Controls/BaseModalWindow.cs b/MediaBrowser.UI.Controls/BaseModalWindow.cs new file mode 100644 index 0000000000..90bd8114f6 --- /dev/null +++ b/MediaBrowser.UI.Controls/BaseModalWindow.cs @@ -0,0 +1,62 @@ +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(); + } + } +} -- cgit v1.2.3