aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.UI.Controls/BaseModalWindow.cs
diff options
context:
space:
mode:
authorLukePulverenti <luke.pulverenti@gmail.com>2013-02-20 20:33:05 -0500
committerLukePulverenti <luke.pulverenti@gmail.com>2013-02-20 20:33:05 -0500
commit767cdc1f6f6a63ce997fc9476911e2c361f9d402 (patch)
tree49add55976f895441167c66cfa95e5c7688d18ce /MediaBrowser.UI.Controls/BaseModalWindow.cs
parent845554722efaed872948a9e0f7202e3ef52f1b6e (diff)
Pushing missing changes
Diffstat (limited to 'MediaBrowser.UI.Controls/BaseModalWindow.cs')
-rw-r--r--MediaBrowser.UI.Controls/BaseModalWindow.cs62
1 files changed, 62 insertions, 0 deletions
diff --git a/MediaBrowser.UI.Controls/BaseModalWindow.cs b/MediaBrowser.UI.Controls/BaseModalWindow.cs
new file mode 100644
index 000000000..90bd8114f
--- /dev/null
+++ b/MediaBrowser.UI.Controls/BaseModalWindow.cs
@@ -0,0 +1,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();
+ }
+ }
+}