diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-23 10:58:08 -0500 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-23 10:58:08 -0500 |
| commit | 17c1fd576057bdd2d6aea517d733fe8af6e6b2ba (patch) | |
| tree | 660f47e816a8599aabdb7ee47f3cde64c72c3f4d /MediaBrowser.UI/Controls/ModalWindow.xaml.cs | |
| parent | 33ed929b526acbda696f00f5966917ebd6a9ded2 (diff) | |
moved ui to it's own repo
Diffstat (limited to 'MediaBrowser.UI/Controls/ModalWindow.xaml.cs')
| -rw-r--r-- | MediaBrowser.UI/Controls/ModalWindow.xaml.cs | 180 |
1 files changed, 0 insertions, 180 deletions
diff --git a/MediaBrowser.UI/Controls/ModalWindow.xaml.cs b/MediaBrowser.UI/Controls/ModalWindow.xaml.cs deleted file mode 100644 index 21f97b8ac..000000000 --- a/MediaBrowser.UI/Controls/ModalWindow.xaml.cs +++ /dev/null @@ -1,180 +0,0 @@ -using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media.Animation; - -namespace MediaBrowser.UI.Controls -{ - /// <summary> - /// Interaction logic for ModalWindow.xaml - /// </summary> - public partial class ModalWindow : BaseModalWindow - { - public MessageBoxResult MessageBoxResult { get; set; } - - public UIElement TextContent - { - set - { - pnlContent.Children.Clear(); - - var textBlock = value as TextBlock; - - if (textBlock != null) - { - textBlock.SetResourceReference(TextBlock.StyleProperty, "ModalTextStyle"); - } - pnlContent.Children.Add(value); - } - } - - public string Text - { - set { TextContent = new TextBlock { Text = value }; } - } - - private MessageBoxButton _button; - public MessageBoxButton Button - { - get { return _button; } - set - { - _button = value; - UpdateButtonVisibility(); - OnPropertyChanged("Button"); - } - } - - private MessageBoxIcon _messageBoxImage; - public MessageBoxIcon MessageBoxImage - { - get { return _messageBoxImage; } - set - { - _messageBoxImage = value; - OnPropertyChanged("MessageBoxImage"); - } - } - - private string _caption; - public string Caption - { - get { return _caption; } - set - { - _caption = value; - txtCaption.Visibility = string.IsNullOrEmpty(value) ? Visibility.Collapsed : Visibility.Visible; - OnPropertyChanged("Caption"); - } - } - - public ModalWindow() - : base() - { - InitializeComponent(); - } - - protected override void OnInitialized(EventArgs e) - { - base.OnInitialized(e); - - btnOk.Click += btnOk_Click; - btnCancel.Click += btnCancel_Click; - btnYes.Click += btnYes_Click; - btnNo.Click += btnNo_Click; - } - - void btnNo_Click(object sender, RoutedEventArgs e) - { - MessageBoxResult = MessageBoxResult.No; - CloseModal(); - } - - void btnYes_Click(object sender, RoutedEventArgs e) - { - MessageBoxResult = MessageBoxResult.Yes; - CloseModal(); - } - - void btnCancel_Click(object sender, RoutedEventArgs e) - { - MessageBoxResult = MessageBoxResult.Cancel; - CloseModal(); - } - - void btnOk_Click(object sender, RoutedEventArgs e) - { - MessageBoxResult = MessageBoxResult.OK; - CloseModal(); - } - - private void UpdateButtonVisibility() - { - btnYes.Visibility = Button == MessageBoxButton.YesNo || Button == MessageBoxButton.YesNoCancel - ? Visibility.Visible - : Visibility.Collapsed; - - btnNo.Visibility = Button == MessageBoxButton.YesNo || Button == MessageBoxButton.YesNoCancel - ? Visibility.Visible - : Visibility.Collapsed; - - btnOk.Visibility = Button == MessageBoxButton.OK || Button == MessageBoxButton.OKCancel - ? Visibility.Visible - : Visibility.Collapsed; - - btnCancel.Visibility = Button == MessageBoxButton.OKCancel || Button == MessageBoxButton.YesNoCancel - ? Visibility.Visible - : Visibility.Collapsed; - } - } - - /// <summary> - /// I had to make my own enum that essentially clones MessageBoxImage - /// Some of the options share the same enum int value, and this was preventing databinding from working properly. - /// </summary> - public enum MessageBoxIcon - { - // Summary: - // No icon is displayed. - None, - // - // Summary: - // The message box contains a symbol consisting of white X in a circle with - // a red background. - Error, - // - // Summary: - // The message box contains a symbol consisting of a white X in a circle with - // a red background. - Hand, - // - // Summary: - // The message box contains a symbol consisting of white X in a circle with - // a red background. - Stop, - // - // Summary: - // The message box contains a symbol consisting of a question mark in a circle. - Question, - // - // Summary: - // The message box contains a symbol consisting of an exclamation point in a - // triangle with a yellow background. - Exclamation, - // - // Summary: - // The message box contains a symbol consisting of an exclamation point in a - // triangle with a yellow background. - Warning, - // - // Summary: - // The message box contains a symbol consisting of a lowercase letter i in a - // circle. - Information, - // - // Summary: - // The message box contains a symbol consisting of a lowercase letter i in a - // circle. - Asterisk - } -} |
