From 17c1fd576057bdd2d6aea517d733fe8af6e6b2ba Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Sat, 23 Feb 2013 10:58:08 -0500 Subject: moved ui to it's own repo --- MediaBrowser.UI.Controls/BaseWindow.cs | 175 --------------------------------- 1 file changed, 175 deletions(-) delete mode 100644 MediaBrowser.UI.Controls/BaseWindow.cs (limited to 'MediaBrowser.UI.Controls/BaseWindow.cs') diff --git a/MediaBrowser.UI.Controls/BaseWindow.cs b/MediaBrowser.UI.Controls/BaseWindow.cs deleted file mode 100644 index 0f3ff2874c..0000000000 --- a/MediaBrowser.UI.Controls/BaseWindow.cs +++ /dev/null @@ -1,175 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows; -using System.Windows.Input; - -namespace MediaBrowser.UI.Controls -{ - /// - /// Provides a base class for all Windows - /// - public abstract class BaseWindow : Window, INotifyPropertyChanged - { - /// - /// Occurs when [property changed]. - /// - public event PropertyChangedEventHandler PropertyChanged; - - /// - /// Called when [property changed]. - /// - /// The info. - public void OnPropertyChanged(String info) - { - if (PropertyChanged != null) - { - PropertyChanged(this, new PropertyChangedEventArgs(info)); - } - } - - /// - /// The _content scale - /// - private double _contentScale = 1; - /// - /// Gets the content scale. - /// - /// The content scale. - public double ContentScale - { - get { return _contentScale; } - private set - { - _contentScale = value; - OnPropertyChanged("ContentScale"); - } - } - - /// - /// Initializes a new instance of the class. - /// - protected BaseWindow() - : base() - { - SizeChanged += MainWindow_SizeChanged; - Loaded += BaseWindowLoaded; - } - - /// - /// Bases the window loaded. - /// - /// The sender. - /// The instance containing the event data. - void BaseWindowLoaded(object sender, RoutedEventArgs e) - { - OnLoaded(); - } - - /// - /// Called when [loaded]. - /// - protected virtual void OnLoaded() - { - MoveFocus(new TraversalRequest(FocusNavigationDirection.First)); - } - - /// - /// Handles the SizeChanged event of the MainWindow control. - /// - /// The source of the event. - /// The instance containing the event data. - void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e) - { - ContentScale = e.NewSize.Height / 1080; - } - - /// - /// Called when [browser back]. - /// - protected virtual void OnBrowserBack() - { - - } - - /// - /// Called when [browser forward]. - /// - protected virtual void OnBrowserForward() - { - - } - - /// - /// Invoked when an unhandled  attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event. - /// - /// The that contains the event data. - protected override void OnPreviewKeyDown(KeyEventArgs e) - { - if (IsBackPress(e)) - { - e.Handled = true; - - if (!e.IsRepeat) - { - OnBrowserBack(); - } - } - - else if (IsForwardPress(e)) - { - e.Handled = true; - - if (!e.IsRepeat) - { - OnBrowserForward(); - } - } - base.OnPreviewKeyDown(e); - } - - /// - /// Determines if a keypress should be treated as a backward press - /// - /// The instance containing the event data. - /// true if [is back press] [the specified e]; otherwise, false. - private bool IsBackPress(KeyEventArgs e) - { - if (e.Key == Key.Escape) - { - return true; - } - - if (e.Key == Key.BrowserBack || e.Key == Key.Back) - { - return true; - } - - if (e.SystemKey == Key.Left && e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Alt)) - { - return true; - } - - return false; - } - - /// - /// Determines if a keypress should be treated as a forward press - /// - /// The instance containing the event data. - /// true if [is forward press] [the specified e]; otherwise, false. - private bool IsForwardPress(KeyEventArgs e) - { - if (e.Key == Key.BrowserForward) - { - return true; - } - - if (e.SystemKey == Key.RightAlt && e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Alt)) - { - return true; - } - - return false; - } - } -} -- cgit v1.2.3