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 | |
| parent | 33ed929b526acbda696f00f5966917ebd6a9ded2 (diff) | |
moved ui to it's own repo
Diffstat (limited to 'MediaBrowser.UI/Controls')
| -rw-r--r-- | MediaBrowser.UI/Controls/ModalWindow.xaml | 67 | ||||
| -rw-r--r-- | MediaBrowser.UI/Controls/ModalWindow.xaml.cs | 180 | ||||
| -rw-r--r-- | MediaBrowser.UI/Controls/NavigationBar.xaml | 55 | ||||
| -rw-r--r-- | MediaBrowser.UI/Controls/NavigationBar.xaml.cs | 318 | ||||
| -rw-r--r-- | MediaBrowser.UI/Controls/NotificationMessage.xaml | 33 | ||||
| -rw-r--r-- | MediaBrowser.UI/Controls/NotificationMessage.xaml.cs | 68 | ||||
| -rw-r--r-- | MediaBrowser.UI/Controls/WindowCommands.xaml | 100 | ||||
| -rw-r--r-- | MediaBrowser.UI/Controls/WindowCommands.xaml.cs | 82 |
8 files changed, 0 insertions, 903 deletions
diff --git a/MediaBrowser.UI/Controls/ModalWindow.xaml b/MediaBrowser.UI/Controls/ModalWindow.xaml deleted file mode 100644 index c2afbe05e..000000000 --- a/MediaBrowser.UI/Controls/ModalWindow.xaml +++ /dev/null @@ -1,67 +0,0 @@ -<controls:BaseModalWindow x:Class="MediaBrowser.UI.Controls.ModalWindow" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Controls="clr-namespace:MediaBrowser.UI.Controls" - xmlns:controls="clr-namespace:MediaBrowser.UI.Controls;assembly=MediaBrowser.UI.Controls" - Title="ModalWindow" - AllowsTransparency="True" - Background="Transparent" - Style="{StaticResource ModalWindow}"> - - <Grid> - <Grid Style="{StaticResource ModalOverlayStyle}"> - - </Grid> - <Grid Style="{StaticResource ModalContentStyle}" RenderTransformOrigin="1,0"> - <Grid Style="{StaticResource ModalContentInnerStyle}"> - - <Grid.ColumnDefinitions> - <ColumnDefinition Width="auto"></ColumnDefinition> - <ColumnDefinition Width="*"></ColumnDefinition> - </Grid.ColumnDefinitions> - - <Grid.RowDefinitions> - <RowDefinition Height="auto"></RowDefinition> - <RowDefinition Height="auto"></RowDefinition> - <RowDefinition Height="auto"></RowDefinition> - </Grid.RowDefinitions> - - <Image Grid.Row="0" Grid.RowSpan="3" Grid.Column="0" Style="{StaticResource ModalButtonImage}"></Image> - - <TextBlock x:Name="txtCaption" Text="{Binding Caption}" Style="{StaticResource Heading2TextBlockStyle}" Grid.Row="0" Grid.Column="1" Margin="0 30 0 10"></TextBlock> - - <Grid x:Name="pnlContent" HorizontalAlignment="Stretch" Grid.Row="1" Grid.Column="1"> - - </Grid> - - <StackPanel x:Name="pnlButtons" Style="{StaticResource ModalButtonPanel}" Grid.Row="2" Grid.Column="1"> - <controls:ExtendedButton x:Name="btnYes" Content="Yes" Style="{StaticResource ModalButton}"></controls:ExtendedButton> - <controls:ExtendedButton x:Name="btnNo" Content="No" Style="{StaticResource ModalButton}"></controls:ExtendedButton> - <controls:ExtendedButton x:Name="btnOk" Content="OK" Style="{StaticResource ModalButton}"></controls:ExtendedButton> - <controls:ExtendedButton x:Name="btnCancel" Content="Cancel" Style="{StaticResource ModalButton}"></controls:ExtendedButton> - </StackPanel> - </Grid> - <!-- Animation --> - <Grid.Triggers> - <EventTrigger RoutedEvent="FrameworkElement.Loaded"> - <BeginStoryboard> - <Storyboard> - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)"> - <SplineDoubleKeyFrame KeyTime="0:0:0" Value="0"/> - <SplineDoubleKeyFrame KeyTime="0:0:0.15" Value="1"/> - </DoubleAnimationUsingKeyFrames> - </Storyboard> - </BeginStoryboard> - </EventTrigger> - </Grid.Triggers> - - <Grid.RenderTransform> - <ScaleTransform ScaleX="1" /> - </Grid.RenderTransform> - </Grid> - - <Grid.LayoutTransform> - <ScaleTransform ScaleX="{Binding Path=ContentScale}" ScaleY="{Binding Path=ContentScale}" CenterX="0" CenterY="0" /> - </Grid.LayoutTransform> - - </Grid> -</controls:BaseModalWindow> 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 - } -} diff --git a/MediaBrowser.UI/Controls/NavigationBar.xaml b/MediaBrowser.UI/Controls/NavigationBar.xaml deleted file mode 100644 index 020fecd6d..000000000 --- a/MediaBrowser.UI/Controls/NavigationBar.xaml +++ /dev/null @@ -1,55 +0,0 @@ -<controls:BaseUserControl x:Class="MediaBrowser.UI.Controls.NavigationBar" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:controls="clr-namespace:MediaBrowser.UI.Controls;assembly=MediaBrowser.UI.Controls" - mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> - <Grid x:Name="NavBarGrid" Style="{StaticResource NavBarGrid}"> - - <Grid Style="{StaticResource NavBarBackgroundGrid}"></Grid> - - <Grid> - <Grid.RowDefinitions> - <RowDefinition Height="auto"></RowDefinition> - <RowDefinition Height="auto"></RowDefinition> - </Grid.RowDefinitions> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="1*"></ColumnDefinition> - <ColumnDefinition Width="1*"></ColumnDefinition> - <ColumnDefinition Width="1*"></ColumnDefinition> - </Grid.ColumnDefinitions> - - <Grid x:Name="SeekGrid" Grid.Row="0" Grid.ColumnSpan="3" Margin="150 15 150 5" Visibility="Collapsed"> - - <Grid.ColumnDefinitions> - <ColumnDefinition Width="auto"></ColumnDefinition> - <ColumnDefinition Width="*"></ColumnDefinition> - <ColumnDefinition Width="auto"></ColumnDefinition> - </Grid.ColumnDefinitions> - - <TextBlock x:Name="TxtCurrentPosition" Grid.Column="0" Style="{StaticResource TextBlockStyle}" Margin="0 0 10 0"></TextBlock> - <Slider x:Name="CurrentPositionSlider" Grid.Column="1" VerticalAlignment="Center" Minimum="0" Thumb.DragStarted="CurrentPositionSlider_DragStarted" Thumb.DragCompleted="CurrentPositionSlider_DragCompleted" IsMoveToPointEnabled="True"></Slider> - <TextBlock x:Name="TxtDuration" Grid.Column="2" Style="{StaticResource TextBlockStyle}" Margin="10 0 0 0"></TextBlock> - - </Grid> - - <StackPanel Style="{StaticResource NavBarGridLeftPanel}" Grid.Row="1"> - <Button x:Name="BackButton" Style="{StaticResource BackButton}"></Button> - </StackPanel> - <StackPanel Style="{StaticResource NavBarGridCenterPanel}" Grid.Row="1"> - <Button x:Name="PreviousChapterButton" Style="{StaticResource PreviousChapterButton}" Visibility="Collapsed"></Button> - <Button x:Name="PlayButton" Style="{StaticResource PlayButton}" Visibility="Collapsed"></Button> - <Button x:Name="PauseButton" Style="{StaticResource PauseButton}" Visibility="Collapsed"></Button> - <Button x:Name="StopButton" Style="{StaticResource StopButton}" Visibility="Collapsed"></Button> - <Button x:Name="NextChapterButton" Style="{StaticResource NextChapterButton}" Visibility="Collapsed"></Button> - </StackPanel> - <StackPanel Style="{StaticResource NavBarGridRightPanel}" Grid.Row="1"> - <Button x:Name="MuteButton" Style="{StaticResource MuteButton}" Visibility="Collapsed"></Button> - <Button x:Name="VolumeDownButton" Style="{StaticResource VolumeDownButton}" Visibility="Collapsed"></Button> - <Button x:Name="VolumeUpButton" Style="{StaticResource VolumeUpButton}" Visibility="Collapsed"></Button> - </StackPanel> - </Grid> - </Grid> -</controls:BaseUserControl> diff --git a/MediaBrowser.UI/Controls/NavigationBar.xaml.cs b/MediaBrowser.UI/Controls/NavigationBar.xaml.cs deleted file mode 100644 index 6d59a7d3a..000000000 --- a/MediaBrowser.UI/Controls/NavigationBar.xaml.cs +++ /dev/null @@ -1,318 +0,0 @@ -using MediaBrowser.UI.Controller; -using MediaBrowser.UI.Playback; -using MediaBrowser.UI.Playback.InternalPlayer; -using System; -using System.Threading; -using System.Windows; -using System.Windows.Controls.Primitives; -using System.Windows.Input; - -namespace MediaBrowser.UI.Controls -{ - /// <summary> - /// Interaction logic for NavigationBar.xaml - /// </summary> - public partial class NavigationBar : BaseUserControl - { - /// <summary> - /// Gets or sets the current player. - /// </summary> - /// <value>The current player.</value> - private BaseMediaPlayer CurrentPlayer { get; set; } - - /// <summary> - /// Gets or sets the current position timer. - /// </summary> - /// <value>The current position timer.</value> - private Timer CurrentPositionTimer { get; set; } - - /// <summary> - /// Initializes a new instance of the <see cref="NavigationBar" /> class. - /// </summary> - public NavigationBar() - { - InitializeComponent(); - - Loaded += NavigationBar_Loaded; - } - - /// <summary> - /// Handles the Loaded event of the NavigationBar control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> - void NavigationBar_Loaded(object sender, RoutedEventArgs e) - { - BackButton.Click += BtnApplicationBackClick; - MuteButton.Click += MuteButton_Click; - - VolumeDownButton.PreviewMouseDown += VolumeDownButton_Click; - VolumeUpButton.PreviewMouseDown += VolumeUpButton_Click; - - StopButton.Click += StopButton_Click; - PlayButton.Click += PlayButton_Click; - PauseButton.Click += PauseButton_Click; - - NextChapterButton.Click += NextChapterButton_Click; - PreviousChapterButton.Click += PreviousChapterButton_Click; - - UIKernel.Instance.PlaybackManager.PlaybackStarted += PlaybackManager_PlaybackStarted; - UIKernel.Instance.PlaybackManager.PlaybackCompleted += PlaybackManager_PlaybackCompleted; - - CurrentPositionSlider.PreviewMouseUp += CurrentPositionSlider_PreviewMouseUp; - } - - /// <summary> - /// Handles the Click event of the PreviousChapterButton control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> - async void PreviousChapterButton_Click(object sender, RoutedEventArgs e) - { - await CurrentPlayer.GoToPreviousChapter(); - } - - /// <summary> - /// Handles the Click event of the NextChapterButton control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> - async void NextChapterButton_Click(object sender, RoutedEventArgs e) - { - await CurrentPlayer.GoToNextChapter(); - } - - /// <summary> - /// Handles the Click event of the PauseButton control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> - async void PauseButton_Click(object sender, RoutedEventArgs e) - { - await CurrentPlayer.Pause(); - } - - /// <summary> - /// Handles the Click event of the PlayButton control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> - async void PlayButton_Click(object sender, RoutedEventArgs e) - { - await CurrentPlayer.UnPause(); - } - - /// <summary> - /// Handles the Click event of the StopButton control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> - async void StopButton_Click(object sender, RoutedEventArgs e) - { - await CurrentPlayer.Stop(); - } - - /// <summary> - /// Handles the PlaybackCompleted event of the PlaybackManager control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="PlaybackEventArgs" /> instance containing the event data.</param> - void PlaybackManager_PlaybackCompleted(object sender, PlaybackStopEventArgs e) - { - if (e.Player == CurrentPlayer) - { - if (CurrentPositionTimer != null) - { - CurrentPositionTimer.Dispose(); - } - - CurrentPlayer.PlayStateChanged -= CurrentPlayer_PlayStateChanged; - CurrentPlayer = null; - ResetButtonVisibilities(null); - - Dispatcher.InvokeAsync(() => TxtCurrentPosition.Text = string.Empty); - } - } - - /// <summary> - /// Handles the Click event of the VolumeUpButton control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> - void VolumeUpButton_Click(object sender, RoutedEventArgs e) - { - CurrentPlayer.Volume += 3; - } - - /// <summary> - /// Handles the Click event of the VolumeDownButton control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> - void VolumeDownButton_Click(object sender, RoutedEventArgs e) - { - CurrentPlayer.Volume -= 3; - } - - /// <summary> - /// Handles the Click event of the MuteButton control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> - void MuteButton_Click(object sender, RoutedEventArgs e) - { - if (CurrentPlayer.CanMute) - { - CurrentPlayer.Mute = !CurrentPlayer.Mute; - } - } - - /// <summary> - /// Handles the PlaybackStarted event of the PlaybackManager control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="PlaybackEventArgs" /> instance containing the event data.</param> - void PlaybackManager_PlaybackStarted(object sender, PlaybackEventArgs e) - { - if (e.Player is BaseInternalMediaPlayer) - { - CurrentPlayer = e.Player; - CurrentPlayer.PlayStateChanged += CurrentPlayer_PlayStateChanged; - - ResetButtonVisibilities(e.Player); - - Dispatcher.InvokeAsync(() => - { - var runtime = e.Player.CurrentMedia.RunTimeTicks ?? 0; - CurrentPositionSlider.Maximum = runtime; - - TxtDuration.Text = GetTimeString(runtime); - - }); - - CurrentPositionTimer = new Timer(CurrentPositionTimerCallback, null, 250, 250); - } - } - - /// <summary> - /// Currents the position timer callback. - /// </summary> - /// <param name="state">The state.</param> - private void CurrentPositionTimerCallback(object state) - { - var time = string.Empty; - - var ticks = CurrentPlayer.CurrentPositionTicks; - - if (ticks.HasValue) - { - time = GetTimeString(ticks.Value); - } - - Dispatcher.InvokeAsync(() => - { - TxtCurrentPosition.Text = time; - - if (!_isPositionSliderDragging) - { - CurrentPositionSlider.Value = ticks ?? 0; - } - }); - } - - /// <summary> - /// Gets the time string. - /// </summary> - /// <param name="ticks">The ticks.</param> - /// <returns>System.String.</returns> - private string GetTimeString(long ticks) - { - var timespan = TimeSpan.FromTicks(ticks); - - return timespan.TotalHours >= 1 ? timespan.ToString("hh':'mm':'ss") : timespan.ToString("mm':'ss"); - } - - /// <summary> - /// Handles the PlayStateChanged event of the CurrentPlayer control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> - void CurrentPlayer_PlayStateChanged(object sender, EventArgs e) - { - ResetButtonVisibilities(CurrentPlayer); - } - - /// <summary> - /// Resets the button visibilities. - /// </summary> - /// <param name="player">The player.</param> - private void ResetButtonVisibilities(BaseMediaPlayer player) - { - Dispatcher.Invoke(() => - { - PlayButton.Visibility = player != null && player.PlayState == PlayState.Paused ? Visibility.Visible : Visibility.Collapsed; - PauseButton.Visibility = player != null && player.CanPause && player.PlayState == PlayState.Playing ? Visibility.Visible : Visibility.Collapsed; - - StopButton.Visibility = player != null ? Visibility.Visible : Visibility.Collapsed; - MuteButton.Visibility = player != null && player.CanMute ? Visibility.Visible : Visibility.Collapsed; - VolumeUpButton.Visibility = player != null && player.CanControlVolume ? Visibility.Visible : Visibility.Collapsed; - VolumeDownButton.Visibility = player != null && player.CanControlVolume ? Visibility.Visible : Visibility.Collapsed; - - var isSeekabke = player != null && player.CanSeek && player.CurrentMedia != null; - SeekGrid.Visibility = isSeekabke ? Visibility.Visible : Visibility.Collapsed; - - var canSeekChapters = isSeekabke && player.CurrentMedia.Chapters != null && player.CurrentMedia.Chapters.Count > 1; - - NextChapterButton.Visibility = canSeekChapters ? Visibility.Visible : Visibility.Collapsed; - PreviousChapterButton.Visibility = canSeekChapters ? Visibility.Visible : Visibility.Collapsed; - }); - } - - /// <summary> - /// BTNs the application back click. - /// </summary> - /// <param name="sender">The sender.</param> - /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> - void BtnApplicationBackClick(object sender, RoutedEventArgs e) - { - App.Instance.ApplicationWindow.NavigateBack(); - } - - /// <summary> - /// The is position slider dragging - /// </summary> - private bool _isPositionSliderDragging; - - /// <summary> - /// Handles the DragStarted event of the CurrentPositionSlider control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="DragStartedEventArgs" /> instance containing the event data.</param> - private void CurrentPositionSlider_DragStarted(object sender, DragStartedEventArgs e) - { - _isPositionSliderDragging = true; - } - - /// <summary> - /// Handles the DragCompleted event of the CurrentPositionSlider control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="DragCompletedEventArgs" /> instance containing the event data.</param> - private void CurrentPositionSlider_DragCompleted(object sender, DragCompletedEventArgs e) - { - _isPositionSliderDragging = false; - - //await CurrentPlayer.Seek(Convert.ToInt64(CurrentPositionSlider.Value)); - } - - /// <summary> - /// Handles the PreviewMouseUp event of the CurrentPositionSlider control. - /// </summary> - /// <param name="sender">The source of the event.</param> - /// <param name="e">The <see cref="MouseButtonEventArgs" /> instance containing the event data.</param> - async void CurrentPositionSlider_PreviewMouseUp(object sender, MouseButtonEventArgs e) - { - await CurrentPlayer.Seek(Convert.ToInt64(CurrentPositionSlider.Value)); - } - } -} diff --git a/MediaBrowser.UI/Controls/NotificationMessage.xaml b/MediaBrowser.UI/Controls/NotificationMessage.xaml deleted file mode 100644 index 6411b6f57..000000000 --- a/MediaBrowser.UI/Controls/NotificationMessage.xaml +++ /dev/null @@ -1,33 +0,0 @@ -<controls:BaseUserControl x:Class="MediaBrowser.UI.Controls.NotificationMessage" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:Controls="clr-namespace:MediaBrowser.UI.Controls" - xmlns:controls="clr-namespace:MediaBrowser.UI.Controls;assembly=MediaBrowser.UI.Controls" - mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> - <Grid Style="{StaticResource NotificationContentStyle}"> - <Grid Style="{StaticResource NotificationContentInnerStyle}"> - - <Grid.ColumnDefinitions> - <ColumnDefinition Width="auto"></ColumnDefinition> - <ColumnDefinition Width="*"></ColumnDefinition> - </Grid.ColumnDefinitions> - - <Grid.RowDefinitions> - <RowDefinition Height="auto"></RowDefinition> - <RowDefinition Height="auto"></RowDefinition> - <RowDefinition Height="auto"></RowDefinition> - </Grid.RowDefinitions> - - <Image Grid.Row="0" Grid.RowSpan="3" Grid.Column="0" Style="{StaticResource NotificationButtonImage}"></Image> - - <TextBlock x:Name="txtCaption" Text="{Binding Caption}" Style="{StaticResource NotificationCaptionStyle}" Grid.Row="0" Grid.Column="1"></TextBlock> - - <Grid x:Name="pnlContent" HorizontalAlignment="Stretch" Grid.Row="1" Grid.Column="1"> - - </Grid> - </Grid> - </Grid> -</controls:BaseUserControl> diff --git a/MediaBrowser.UI/Controls/NotificationMessage.xaml.cs b/MediaBrowser.UI/Controls/NotificationMessage.xaml.cs deleted file mode 100644 index 06ed513b1..000000000 --- a/MediaBrowser.UI/Controls/NotificationMessage.xaml.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Windows; -using System.Windows.Controls; - -namespace MediaBrowser.UI.Controls -{ - /// <summary> - /// Interaction logic for NotificationMessage.xaml - /// </summary> - public partial class NotificationMessage : BaseUserControl - { - public NotificationMessage() - { - InitializeComponent(); - } - - public UIElement TextContent - { - set - { - pnlContent.Children.Clear(); - - var textBlock = value as TextBlock; - - if (textBlock != null) - { - textBlock.SetResourceReference(TextBlock.StyleProperty, "NotificationTextStyle"); - } - pnlContent.Children.Add(value); - } - } - - public string Text - { - set { TextContent = new TextBlock { Text = value }; } - } - - 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; - OnPropertyChanged("Caption"); - txtCaption.Visibility = string.IsNullOrEmpty(value) ? Visibility.Collapsed : Visibility.Visible; - } - } - - protected override void OnInitialized(EventArgs e) - { - base.OnInitialized(e); - - DataContext = this; - } - } -} diff --git a/MediaBrowser.UI/Controls/WindowCommands.xaml b/MediaBrowser.UI/Controls/WindowCommands.xaml deleted file mode 100644 index bca881238..000000000 --- a/MediaBrowser.UI/Controls/WindowCommands.xaml +++ /dev/null @@ -1,100 +0,0 @@ -<UserControl x:Class="MediaBrowser.UI.Controls.WindowCommands" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> - - <UserControl.Resources> - - <Style TargetType="StackPanel" x:Key="WindowCommandsPanel"> - <Setter Property="Orientation" Value="Horizontal"/> - <Setter Property="HorizontalAlignment" Value="Right"/> - </Style> - - <Style TargetType="Button" x:Key="WebdingsButton"> - <Setter Property="Margin" Value="0 0 15 0"/> - <Setter Property="KeyboardNavigation.IsTabStop" Value="false"/> - <Setter Property="Padding" Value="0"/> - <Setter Property="BorderThickness" Value="0"/> - <Style.Triggers> - <Trigger Property="IsMouseOver" Value="True"> - <Setter Property="Opacity" Value=".5" /> - </Trigger> - </Style.Triggers> - </Style> - - <Style TargetType="TextBlock" x:Key="WebdingsTextBlock"> - <Setter Property="FontFamily" Value="Webdings"/> - <Setter Property="FontSize" Value="14"/> - <Setter Property="Foreground" Value="{StaticResource DefaultForeground}"/> - </Style> - - <Style TargetType="Button" x:Key="MinimizeApplicationButton" BasedOn="{StaticResource WebdingsButton}"> - <Setter Property="ToolTip" Value="Minimize"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate> - <TextBlock Style="{StaticResource WebdingsTextBlock}">0</TextBlock> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> - - <Style TargetType="Button" x:Key="MaximizeApplicationButton" BasedOn="{StaticResource WebdingsButton}"> - <Setter Property="ToolTip" Value="Maximize"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate> - <TextBlock Style="{StaticResource WebdingsTextBlock}">1</TextBlock> - </ControlTemplate> - </Setter.Value> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="Maximized"> - <Setter Property="Visibility" Value="Collapsed" /> - </DataTrigger> - </Style.Triggers> - </Style> - - <Style TargetType="Button" x:Key="UndoMaximizeApplicationButton" BasedOn="{StaticResource WebdingsButton}"> - <Setter Property="Visibility" Value="Collapsed"/> - <Setter Property="ToolTip" Value="Restore"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate> - <TextBlock Style="{StaticResource WebdingsTextBlock}">2</TextBlock> - </ControlTemplate> - </Setter.Value> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="Maximized"> - <Setter Property="Visibility" Value="Visible" /> - </DataTrigger> - </Style.Triggers> - </Style> - - <Style TargetType="Button" x:Key="CloseApplicationButton" BasedOn="{StaticResource WebdingsButton}"> - <Setter Property="ToolTip" Value="Close"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate> - <TextBlock Style="{StaticResource WebdingsTextBlock}">r</TextBlock> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> - - </UserControl.Resources> - - <StackPanel Style="{StaticResource WindowCommandsPanel}"> - <Button x:Name="MinimizeApplicationButton" Style="{StaticResource MinimizeApplicationButton}"> - </Button> - <Button x:Name="MaximizeApplicationButton" Style="{StaticResource MaximizeApplicationButton}"> - </Button> - <Button x:Name="UndoMaximizeApplicationButton" Style="{StaticResource UndoMaximizeApplicationButton}"></Button> - <Button x:Name="CloseApplicationButton" Style="{StaticResource CloseApplicationButton}"></Button> - </StackPanel> - -</UserControl> diff --git a/MediaBrowser.UI/Controls/WindowCommands.xaml.cs b/MediaBrowser.UI/Controls/WindowCommands.xaml.cs deleted file mode 100644 index e285cced1..000000000 --- a/MediaBrowser.UI/Controls/WindowCommands.xaml.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System.Windows; -using System.Windows.Controls; - -namespace MediaBrowser.UI.Controls -{ - /// <summary> - /// Interaction logic for WindowCommands.xaml - /// </summary> - public partial class WindowCommands : UserControl - { - /// <summary> - /// Gets the parent window. - /// </summary> - /// <value>The parent window.</value> - public Window ParentWindow - { - get { return TreeHelper.TryFindParent<Window>(this); } - } - - /// <summary> - /// Initializes a new instance of the <see cref="WindowCommands" /> class. - /// </summary> - public WindowCommands() - { - InitializeComponent(); - Loaded += WindowCommandsLoaded; - } - - /// <summary> - /// Windows the commands loaded. - /// </summary> - /// <param name="sender">The sender.</param> - /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> - void WindowCommandsLoaded(object sender, RoutedEventArgs e) - { - CloseApplicationButton.Click += CloseApplicationButtonClick; - MinimizeApplicationButton.Click += MinimizeApplicationButtonClick; - MaximizeApplicationButton.Click += MaximizeApplicationButtonClick; - UndoMaximizeApplicationButton.Click += UndoMaximizeApplicationButtonClick; - } - - /// <summary> - /// Undoes the maximize application button click. - /// </summary> - /// <param name="sender">The sender.</param> - /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> - void UndoMaximizeApplicationButtonClick(object sender, RoutedEventArgs e) - { - ParentWindow.WindowState = WindowState.Normal; - } - - /// <summary> - /// Maximizes the application button click. - /// </summary> - /// <param name="sender">The sender.</param> - /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> - void MaximizeApplicationButtonClick(object sender, RoutedEventArgs e) - { - ParentWindow.WindowState = WindowState.Maximized; - } - - /// <summary> - /// Minimizes the application button click. - /// </summary> - /// <param name="sender">The sender.</param> - /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> - void MinimizeApplicationButtonClick(object sender, RoutedEventArgs e) - { - ParentWindow.WindowState = WindowState.Minimized; - } - - /// <summary> - /// Closes the application button click. - /// </summary> - /// <param name="sender">The sender.</param> - /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> - void CloseApplicationButtonClick(object sender, RoutedEventArgs e) - { - App.Instance.Shutdown(); - } - } -} |
