diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/BaseItemTile.xaml b/MediaBrowser.Plugins.DefaultTheme/Controls/BaseItemTile.xaml deleted file mode 100644 index a66b1c4030..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/BaseItemTile.xaml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/BaseItemTile.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Controls/BaseItemTile.xaml.cs deleted file mode 100644 index 690a539f81..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/BaseItemTile.xaml.cs +++ /dev/null @@ -1,177 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Net; -using MediaBrowser.UI; -using MediaBrowser.UI.Controls; -using MediaBrowser.UI.Converters; -using MediaBrowser.UI.ViewModels; -using System; -using System.ComponentModel; -using System.Windows; - -namespace MediaBrowser.Plugins.DefaultTheme.Controls -{ - /// - /// Interaction logic for BaseItemTile.xaml - /// - public partial class BaseItemTile : BaseUserControl - { - /// - /// Gets the view model. - /// - /// The view model. - public DtoBaseItemViewModel ViewModel - { - get { return DataContext as DtoBaseItemViewModel; } - } - - /// - /// Gets the item. - /// - /// The item. - private BaseItemDto Item - { - get { return ViewModel.Item; } - } - - /// - /// Initializes a new instance of the class. - /// - public BaseItemTile() - { - InitializeComponent(); - - DataContextChanged += BaseItemTile_DataContextChanged; - Loaded += BaseItemTile_Loaded; - Unloaded += BaseItemTile_Unloaded; - } - - /// - /// Handles the Unloaded event of the BaseItemTile control. - /// - /// The source of the event. - /// The instance containing the event data. - void BaseItemTile_Unloaded(object sender, RoutedEventArgs e) - { - if (ViewModel != null) - { - ViewModel.PropertyChanged -= ViewModel_PropertyChanged; - } - } - - /// - /// Handles the Loaded event of the BaseItemTile control. - /// - /// The source of the event. - /// The instance containing the event data. - void BaseItemTile_Loaded(object sender, RoutedEventArgs e) - { - if (ViewModel != null) - { - ViewModel.PropertyChanged -= ViewModel_PropertyChanged; - ViewModel.PropertyChanged += ViewModel_PropertyChanged; - } - } - - /// - /// Handles the DataContextChanged event of the BaseItemTile control. - /// - /// The source of the event. - /// The instance containing the event data. - void BaseItemTile_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) - { - OnItemChanged(); - - if (ViewModel != null) - { - ViewModel.PropertyChanged -= ViewModel_PropertyChanged; - ViewModel.PropertyChanged += ViewModel_PropertyChanged; - } - } - - /// - /// Handles the PropertyChanged event of the ViewModel control. - /// - /// The source of the event. - /// The instance containing the event data. - void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e) - { - ReloadImage(); - } - - /// - /// Called when [item changed]. - /// - private void OnItemChanged() - { - ReloadImage(); - - var visibility = Item.HasPrimaryImage && !Item.IsType("Episode") ? Visibility.Collapsed : Visibility.Visible; - - if (Item.IsType("Person") || Item.IsType("IndexFolder")) - { - visibility = Visibility.Visible; - } - - txtName.Visibility = visibility; - - var name = Item.Name; - - if (Item.IndexNumber.HasValue) - { - name = Item.IndexNumber + " - " + name; - } - - txtName.Text = name; - } - - /// - /// Reloads the image. - /// - private async void ReloadImage() - { - mainGrid.Height = ViewModel.ParentDisplayPreferences.PrimaryImageHeight; - mainGrid.Width = ViewModel.ParentDisplayPreferences.PrimaryImageWidth; - - if (Item.HasPrimaryImage) - { - var url = ViewModel.GetImageUrl(ViewModel.ParentDisplayPreferences.PrimaryImageType); - - border.Background = null; - - try - { - image.Source = await App.Instance.GetRemoteBitmapAsync(url); - } - catch (HttpException) - { - SetDefaultImage(); - } - } - else - { - SetDefaultImage(); - } - } - - /// - /// Sets the default image. - /// - private void SetDefaultImage() - { - if (Item.IsAudio || Item.IsType("MusicAlbum") || Item.IsType("MusicArtist")) - { - var imageUri = new Uri("../Resources/Images/AudioDefault.png", UriKind.Relative); - - border.Background = MetroTileBackgroundConverter.GetRandomBackground(); - image.Source = App.Instance.GetBitmapImage(imageUri); - } - else - { - var imageUri = new Uri("../Resources/Images/VideoDefault.png", UriKind.Relative); - - border.Background = MetroTileBackgroundConverter.GetRandomBackground(); - image.Source = App.Instance.GetBitmapImage(imageUri); - } - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/BaseDetailsControl.cs b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/BaseDetailsControl.cs deleted file mode 100644 index 530788aead..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/BaseDetailsControl.cs +++ /dev/null @@ -1,44 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.UI.Controls; - -namespace MediaBrowser.Plugins.DefaultTheme.Controls.Details -{ - /// - /// Class BaseDetailsControl - /// - public abstract class BaseDetailsControl : BaseUserControl - { - /// - /// Initializes a new instance of the class. - /// - protected BaseDetailsControl() - { - DataContext = this; - } - - /// - /// The _item - /// - private BaseItemDto _item; - /// - /// Gets or sets the item. - /// - /// The item. - public BaseItemDto Item - { - get { return _item; } - - set - { - _item = value; - OnPropertyChanged("Item"); - OnItemChanged(); - } - } - - /// - /// Called when [item changed]. - /// - protected abstract void OnItemChanged(); - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemChapters.xaml b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemChapters.xaml deleted file mode 100644 index 4282316b41..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemChapters.xaml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemChapters.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemChapters.xaml.cs deleted file mode 100644 index d9f40b0149..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemChapters.xaml.cs +++ /dev/null @@ -1,67 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.UI.Controller; -using MediaBrowser.UI.Controls; -using MediaBrowser.UI.Playback; -using MediaBrowser.UI.ViewModels; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; - -namespace MediaBrowser.Plugins.DefaultTheme.Controls.Details -{ - /// - /// Interaction logic for ItemChapters.xaml - /// - public partial class ItemChapters : BaseDetailsControl - { - /// - /// Initializes a new instance of the class. - /// - public ItemChapters() - { - InitializeComponent(); - - lstItems.ItemInvoked += lstItems_ItemInvoked; - } - - /// - /// LSTs the items_ item invoked. - /// - /// The sender. - /// The e. - void lstItems_ItemInvoked(object sender, ItemEventArgs e) - { - var chapterViewModel = (ChapterInfoDtoViewModel) e.Argument; - - UIKernel.Instance.PlaybackManager.Play(new PlayOptions - { - Items = new List { Item }, - StartPositionTicks = chapterViewModel.Chapter.StartPositionTicks - }); - } - - /// - /// Called when [item changed]. - /// - protected override void OnItemChanged() - { - const double height = 297; - - var width = ChapterInfoDtoViewModel.GetChapterImageWidth(Item, height, 528); - - var chapters = Item.Chapters ?? new List { }; - - lstItems.ItemsSource = new ObservableCollection(chapters.Select(i => new ChapterInfoDtoViewModel - { - Item = Item, - Chapter = i, - ImageWidth = width, - ImageHeight = height, - ImageDownloadOptions = new ImageOptions - { - MaxHeight = 400 - } - })); - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemGallery.xaml b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemGallery.xaml deleted file mode 100644 index 3127425588..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemGallery.xaml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemGallery.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemGallery.xaml.cs deleted file mode 100644 index c315a0f7fa..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemGallery.xaml.cs +++ /dev/null @@ -1,163 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Net; -using MediaBrowser.UI; -using MediaBrowser.UI.Controller; -using MediaBrowser.UI.Controls; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Media.Imaging; - -namespace MediaBrowser.Plugins.DefaultTheme.Controls.Details -{ - /// - /// Interaction logic for ItemGallery.xaml - /// - public partial class ItemGallery : BaseDetailsControl - { - /// - /// Initializes a new instance of the class. - /// - public ItemGallery() - : base() - { - InitializeComponent(); - lstItems.ItemInvoked += lstItems_ItemInvoked; - } - - /// - /// LSTs the items_ item invoked. - /// - /// The sender. - /// The e. - void lstItems_ItemInvoked(object sender, ItemEventArgs e) - { - var img = (BitmapImage)e.Argument; - - var index = Images.IndexOf(img); - - //App.Instance.OpenImageViewer(new Uri(ImageUrls[index]), Item.Name); - } - - /// - /// The _images - /// - private List _images; - /// - /// Gets or sets the images. - /// - /// The images. - public List Images - { - get { return _images; } - set - { - _images = value; - lstItems.ItemsSource = value; - OnPropertyChanged("Images"); - } - } - - /// - /// Gets or sets the image urls. - /// - /// The image urls. - private List ImageUrls { get; set; } - - /// - /// Called when [item changed]. - /// - protected override async void OnItemChanged() - { - ImageUrls = GetImages(Item); - - var tasks = ImageUrls.Select(GetImage); - - var results = await Task.WhenAll(tasks); - - Images = results.Where(i => i != null).ToList(); - } - - /// - /// Gets the image. - /// - /// The URL. - /// Task{BitmapImage}. - private async Task GetImage(string url) - { - try - { - return await App.Instance.GetRemoteBitmapAsync(url); - } - catch (HttpException) - { - return null; - } - } - - /// - /// Gets the images. - /// - /// The item. - /// List{System.String}. - internal static List GetImages(BaseItemDto item) - { - var images = new List { }; - - if (item.BackdropCount > 0) - { - for (var i = 0; i < item.BackdropCount; i++) - { - images.Add(UIKernel.Instance.ApiClient.GetImageUrl(item, new ImageOptions - { - ImageType = ImageType.Backdrop, - ImageIndex = i - })); - } - } - - if (item.HasThumb) - { - images.Add(UIKernel.Instance.ApiClient.GetImageUrl(item, new ImageOptions - { - ImageType = ImageType.Thumb - })); - } - - if (item.HasArtImage) - { - images.Add(UIKernel.Instance.ApiClient.GetImageUrl(item, new ImageOptions - { - ImageType = ImageType.Art - })); - } - - if (item.HasDiscImage) - { - images.Add(UIKernel.Instance.ApiClient.GetImageUrl(item, new ImageOptions - { - ImageType = ImageType.Disc - })); - } - - if (item.HasMenuImage) - { - images.Add(UIKernel.Instance.ApiClient.GetImageUrl(item, new ImageOptions - { - ImageType = ImageType.Menu - })); - } - - if (item.HasBoxImage) - { - images.Add(UIKernel.Instance.ApiClient.GetImageUrl(item, new ImageOptions - { - ImageType = ImageType.Box - })); - } - - return images; - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemMediaInfo.xaml b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemMediaInfo.xaml deleted file mode 100644 index 0cae37a359..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemMediaInfo.xaml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemMediaInfo.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemMediaInfo.xaml.cs deleted file mode 100644 index 3912093c76..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemMediaInfo.xaml.cs +++ /dev/null @@ -1,49 +0,0 @@ -using MediaBrowser.Model.Entities; -using System.Collections.Generic; -using System.Windows; - -namespace MediaBrowser.Plugins.DefaultTheme.Controls.Details -{ - /// - /// Interaction logic for ItemMediaInfo.xaml - /// - public partial class ItemMediaInfo : BaseDetailsControl - { - /// - /// Initializes a new instance of the class. - /// - public ItemMediaInfo() - { - InitializeComponent(); - } - - /// - /// Called when [item changed]. - /// - protected override void OnItemChanged() - { - MediaStreams.Children.Clear(); - - TxtPath.Text = Item.Path; - - if (Item.VideoFormat.HasValue && Item.VideoFormat.Value != VideoFormat.Standard) - { - TxtVideoFormat.Visibility = Visibility.Visible; - - TxtVideoFormat.Text = Item.VideoFormat.Value == VideoFormat.Digital3D ? "Digital 3D" : "SBS 3D"; - } - else - { - TxtVideoFormat.Visibility = Visibility.Collapsed; - } - - foreach (var stream in Item.MediaStreams ?? new List {}) - { - MediaStreams.Children.Add(new MediaStreamControl - { - MediaStream = stream - }); - } - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemOverview.xaml b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemOverview.xaml deleted file mode 100644 index 32e16ce9d2..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemOverview.xaml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemOverview.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemOverview.xaml.cs deleted file mode 100644 index 3c1eb52ec3..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemOverview.xaml.cs +++ /dev/null @@ -1,109 +0,0 @@ -using MediaBrowser.Model.Dto; -using System; -using System.Linq; -using System.Windows; - -namespace MediaBrowser.Plugins.DefaultTheme.Controls.Details -{ - /// - /// Interaction logic for ItemOverview.xaml - /// - public partial class ItemOverview : BaseDetailsControl - { - /// - /// Initializes a new instance of the class. - /// - public ItemOverview() - : base() - { - InitializeComponent(); - } - - /// - /// Called when [item changed]. - /// - protected override void OnItemChanged() - { - var directors = (Item.People ?? new BaseItemPerson[] { }).Where(p => string.Equals(p.Type, "director", StringComparison.OrdinalIgnoreCase)).ToList(); - - if (directors.Count > 0) - { - PnlDirectors.Visibility = Visibility.Visible; - - Directors.Text = string.Join(" / ", directors.Take(3).Select(d => d.Name).ToArray()); - DirectorLabel.Text = directors.Count > 1 ? "directors" : "director"; - } - else - { - PnlDirectors.Visibility = Visibility.Collapsed; - } - - if (Item.Genres != null && Item.Genres.Count > 0) - { - PnlGenres.Visibility = Visibility.Visible; - - Genres.Text = string.Join(" / ", Item.Genres.Take(4).ToArray()); - GenreLabel.Text = Item.Genres.Count > 1 ? "genres" : "genre"; - } - else - { - PnlGenres.Visibility = Visibility.Collapsed; - } - - if (Item.Studios != null && Item.Studios.Count > 0) - { - PnlStudios.Visibility = Visibility.Visible; - - Studios.Text = string.Join(" / ", Item.Studios.Take(3).ToArray()); - StudiosLabel.Text = Item.Studios.Count > 1 ? "studios" : "studio"; - } - else - { - PnlStudios.Visibility = Visibility.Collapsed; - } - - if (Item.PremiereDate.HasValue) - { - PnlPremiereDate.Visibility = Visibility.Visible; - - PremiereDate.Text = Item.PremiereDate.Value.ToShortDateString(); - } - else - { - PnlPremiereDate.Visibility = Visibility.Collapsed; - } - - if (!string.IsNullOrEmpty(Item.Artist)) - { - PnlArtist.Visibility = Visibility.Visible; - Artist.Text = Item.Artist; - } - else - { - PnlArtist.Visibility = Visibility.Collapsed; - } - - if (!string.IsNullOrEmpty(Item.Album)) - { - PnlAlbum.Visibility = Visibility.Visible; - Album.Text = Item.Artist; - } - else - { - PnlAlbum.Visibility = Visibility.Collapsed; - } - - if (!string.IsNullOrEmpty(Item.AlbumArtist)) - { - PnlAlbumArtist.Visibility = Visibility.Visible; - AlbumArtist.Text = Item.Artist; - } - else - { - PnlAlbumArtist.Visibility = Visibility.Collapsed; - } - - Overview.Text = Item.Overview; - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemPerformers.xaml b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemPerformers.xaml deleted file mode 100644 index 6e2bc9f57a..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemPerformers.xaml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemPerformers.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemPerformers.xaml.cs deleted file mode 100644 index 0ea9a052e7..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemPerformers.xaml.cs +++ /dev/null @@ -1,72 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.UI; -using MediaBrowser.UI.Controller; -using MediaBrowser.UI.ViewModels; -using System.Collections.ObjectModel; - -namespace MediaBrowser.Plugins.DefaultTheme.Controls.Details -{ - /// - /// Interaction logic for ItemPerformers.xaml - /// - public partial class ItemPerformers : BaseDetailsControl - { - /// - /// Initializes a new instance of the class. - /// - public ItemPerformers() - { - InitializeComponent(); - } - - /// - /// The _itemsResult - /// - private ItemsResult _itemsResult; - /// - /// Gets or sets the children of the Folder being displayed - /// - /// The children. - public ItemsResult ItemsResult - { - get { return _itemsResult; } - - private set - { - _itemsResult = value; - OnPropertyChanged("ItemsResult"); - - Items = DtoBaseItemViewModel.GetObservableItems(ItemsResult.Items); - } - } - - /// - /// The _display children - /// - private ObservableCollection _items; - /// - /// Gets the actual children that should be displayed. - /// Subclasses should bind to this, not ItemsResult. - /// - /// The display children. - public ObservableCollection Items - { - get { return _items; } - - private set - { - _items = value; - //lstItems.ItemsSource = value; - OnPropertyChanged("Items"); - } - } - - /// - /// Called when [item changed]. - /// - protected override async void OnItemChanged() - { - ItemsResult = await UIKernel.Instance.ApiClient.GetAllPeopleAsync(App.Instance.CurrentUser.Id, itemId: Item.Id); - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemSpecialFeatures.xaml b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemSpecialFeatures.xaml deleted file mode 100644 index 09d64612e2..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemSpecialFeatures.xaml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemSpecialFeatures.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemSpecialFeatures.xaml.cs deleted file mode 100644 index d62c6d157e..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemSpecialFeatures.xaml.cs +++ /dev/null @@ -1,77 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Net; -using MediaBrowser.UI; -using MediaBrowser.UI.Controller; -using MediaBrowser.UI.Controls; -using MediaBrowser.UI.Playback; -using MediaBrowser.UI.ViewModels; -using System.Collections.Generic; -using System.Linq; - -namespace MediaBrowser.Plugins.DefaultTheme.Controls.Details -{ - /// - /// Interaction logic for ItemSpecialFeatures.xaml - /// - public partial class ItemSpecialFeatures : BaseDetailsControl - { - /// - /// Initializes a new instance of the class. - /// - public ItemSpecialFeatures() - { - InitializeComponent(); - - lstItems.ItemInvoked += lstItems_ItemInvoked; - } - - /// - /// LSTs the items_ item invoked. - /// - /// The sender. - /// The e. - void lstItems_ItemInvoked(object sender, ItemEventArgs e) - { - var viewModel = (SpecialFeatureViewModel) e.Argument; - - UIKernel.Instance.PlaybackManager.Play(new PlayOptions - { - Items = new List { viewModel.Item } - }); - } - - /// - /// Called when [item changed]. - /// - protected override async void OnItemChanged() - { - BaseItemDto[] result; - - try - { - result = await UIKernel.Instance.ApiClient.GetSpecialFeaturesAsync(App.Instance.CurrentUser.Id, Item.Id); - } - catch (HttpException) - { - App.Instance.ShowDefaultErrorMessage(); - - return; - } - - var resultItems = result ?? new BaseItemDto[] { }; - - const int height = 297; - var aspectRatio = DtoBaseItemViewModel.GetAveragePrimaryImageAspectRatio(resultItems); - - var width = aspectRatio == 0 ? 528 : height * aspectRatio; - - lstItems.ItemsSource = resultItems.Select(i => new SpecialFeatureViewModel - { - Item = i, - ImageHeight = height, - ImageWidth = width - - }).ToList(); - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemTrailers.xaml b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemTrailers.xaml deleted file mode 100644 index 1298852718..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemTrailers.xaml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemTrailers.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemTrailers.xaml.cs deleted file mode 100644 index 9d92aafbb1..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/ItemTrailers.xaml.cs +++ /dev/null @@ -1,82 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Net; -using MediaBrowser.UI; -using MediaBrowser.UI.Controller; -using MediaBrowser.UI.Controls; -using MediaBrowser.UI.Playback; -using MediaBrowser.UI.ViewModels; -using System.Collections.Generic; -using System.Linq; - -namespace MediaBrowser.Plugins.DefaultTheme.Controls.Details -{ - /// - /// Interaction logic for ItemTrailers.xaml - /// - public partial class ItemTrailers : BaseDetailsControl - { - /// - /// Initializes a new instance of the class. - /// - public ItemTrailers() - { - InitializeComponent(); - - lstItems.ItemInvoked += lstItems_ItemInvoked; - } - - /// - /// LSTs the items_ item invoked. - /// - /// The sender. - /// The e. - void lstItems_ItemInvoked(object sender, ItemEventArgs e) - { - var viewModel = (SpecialFeatureViewModel)e.Argument; - - UIKernel.Instance.PlaybackManager.Play(new PlayOptions - { - Items = new List { viewModel.Item } - }); - } - - /// - /// Called when [item changed]. - /// - protected override async void OnItemChanged() - { - BaseItemDto[] result; - - try - { - result = await UIKernel.Instance.ApiClient.GetLocalTrailersAsync(App.Instance.CurrentUser.Id, Item.Id); - } - catch (HttpException) - { - App.Instance.ShowDefaultErrorMessage(); - - return; - } - - var resultItems = result ?? new BaseItemDto[] { }; - - const int height = 297; - var aspectRatio = DtoBaseItemViewModel.GetAveragePrimaryImageAspectRatio(resultItems); - - var width = aspectRatio == 0 ? 528 : height * aspectRatio; - - if (Item.TrailerUrls != null) - { - //resultItems.AddRange(Item.TrailerUrls.Select(i => UIKernel.Instance.PlaybackManager.GetPlayableItem(new Uri(i), "Trailer"))); - } - - lstItems.ItemsSource = resultItems.Select(i => new SpecialFeatureViewModel - { - Item = i, - ImageHeight = height, - ImageWidth = width - - }).ToList(); - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/MediaStreamControl.xaml b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/MediaStreamControl.xaml deleted file mode 100644 index e841693fed..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/MediaStreamControl.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/MediaStreamControl.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Controls/Details/MediaStreamControl.xaml.cs deleted file mode 100644 index c0271cdab3..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/Details/MediaStreamControl.xaml.cs +++ /dev/null @@ -1,142 +0,0 @@ -using MediaBrowser.Model.Entities; -using MediaBrowser.UI.Controls; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Windows.Controls; - -namespace MediaBrowser.Plugins.DefaultTheme.Controls.Details -{ - /// - /// Interaction logic for MediaStreamControl.xaml - /// - public partial class MediaStreamControl : BaseUserControl - { - private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); - - /// - /// Initializes a new instance of the class. - /// - public MediaStreamControl() - { - InitializeComponent(); - } - - /// - /// The _media stream - /// - private MediaStream _mediaStream; - /// - /// Gets or sets the media stream. - /// - /// The media stream. - public MediaStream MediaStream - { - get { return _mediaStream; } - set - { - _mediaStream = value; - OnPropertyChanged("MediaStream"); - OnStreamChanged(); - } - } - - /// - /// Called when [stream changed]. - /// - private void OnStreamChanged() - { - if (MediaStream == null) - { - StreamName.Text = string.Empty; - StreamDetails.Children.Clear(); - return; - } - - var details = new List { }; - - if (MediaStream.Type != MediaStreamType.Video) - { - AddDetail(details, MediaStream.Language); - } - - if (!string.IsNullOrEmpty(MediaStream.Path)) - { - AddDetail(details, Path.GetFileName(MediaStream.Path)); - } - - if (MediaStream.Type == MediaStreamType.Video) - { - var resolution = string.Format("{0}*{1}", MediaStream.Width, MediaStream.Height); - - AddDetail(details, resolution); - } - - AddDetail(details, MediaStream.AspectRatio); - - if (MediaStream.Type != MediaStreamType.Video) - { - if (MediaStream.IsDefault) - { - //AddDetail(details, "default"); - } - if (MediaStream.IsForced) - { - AddDetail(details, "forced"); - } - } - - AddDetail(details, MediaStream.Codec); - - if (MediaStream.Channels.HasValue) - { - AddDetail(details, MediaStream.Channels.Value.ToString(UsCulture) + "ch"); - } - - if (MediaStream.BitRate.HasValue) - { - var text = (MediaStream.BitRate.Value / 1000).ToString(UsCulture) + "kbps"; - - AddDetail(details, text); - } - - var framerate = MediaStream.AverageFrameRate ?? MediaStream.RealFrameRate ?? 0; - - if (framerate > 0) - { - AddDetail(details, framerate.ToString(UsCulture)); - } - - if (MediaStream.SampleRate.HasValue) - { - AddDetail(details, MediaStream.SampleRate.Value.ToString(UsCulture) + "khz"); - } - - AddDetail(string.Join(" \u2022 ", details.ToArray())); - - StreamName.Text = MediaStream.Type.ToString(); - } - - private void AddDetail(string text) - { - if (string.IsNullOrEmpty(text)) - { - return; - } - - var control = new TextBlock() { Text = text }; - control.SetResourceReference(StyleProperty, "TextBlockStyle"); - StreamDetails.Children.Add(control); - } - - private void AddDetail(ICollection list, string text) - { - if (string.IsNullOrEmpty(text)) - { - return; - } - - list.Add(text); - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/HomePageTile.xaml b/MediaBrowser.Plugins.DefaultTheme/Controls/HomePageTile.xaml deleted file mode 100644 index 8de68eff9b..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/HomePageTile.xaml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/HomePageTile.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Controls/HomePageTile.xaml.cs deleted file mode 100644 index 9753851fac..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/HomePageTile.xaml.cs +++ /dev/null @@ -1,128 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Net; -using MediaBrowser.UI; -using MediaBrowser.UI.Controls; -using MediaBrowser.UI.ViewModels; -using System; -using System.Windows; - -namespace MediaBrowser.Plugins.DefaultTheme.Controls -{ - /// - /// Interaction logic for BaseItemTile.xaml - /// - public partial class HomePageTile : BaseUserControl - { - /// - /// Gets the view model. - /// - /// The view model. - public DtoBaseItemViewModel ViewModel - { - get { return DataContext as DtoBaseItemViewModel; } - } - - /// - /// Gets the item. - /// - /// The item. - private BaseItemDto Item - { - get { return ViewModel.Item; } - } - - /// - /// Initializes a new instance of the class. - /// - public HomePageTile() - { - InitializeComponent(); - - DataContextChanged += BaseItemTile_DataContextChanged; - } - - /// - /// Handles the DataContextChanged event of the BaseItemTile control. - /// - /// The source of the event. - /// The instance containing the event data. - void BaseItemTile_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) - { - OnItemChanged(); - } - - /// - /// Called when [item changed]. - /// - private void OnItemChanged() - { - ReloadImage(); - } - - /// - /// Reloads the image. - /// - private void ReloadImage() - { - if (Item.HasPrimaryImage) - { - var url = App.Instance.ApiClient.GetImageUrl(Item, new ImageOptions - { - ImageType = ImageType.Primary, - Height = 225 - }); - - SetImage(url); - } - else if (Item.BackdropCount > 0) - { - var url = App.Instance.ApiClient.GetImageUrl(Item, new ImageOptions - { - ImageType = ImageType.Backdrop, - Height = 225, - Width = 400 - }); - - SetImage(url); - } - else if (Item.HasThumb) - { - var url = App.Instance.ApiClient.GetImageUrl(Item, new ImageOptions - { - ImageType = ImageType.Thumb, - Height = 225, - Width = 400 - }); - - SetImage(url); - } - else - { - SetDefaultImage(); - } - } - - /// - /// Sets the image. - /// - /// The URL. - private async void SetImage(string url) - { - try - { - image.Source = await App.Instance.GetRemoteBitmapAsync(url); - } - catch (HttpException) - { - SetDefaultImage(); - } - } - - private void SetDefaultImage() - { - var imageUri = new Uri("../Resources/Images/VideoDefault.png", UriKind.Relative); - image.Source = App.Instance.GetBitmapImage(imageUri); - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/MultiItemTile.xaml b/MediaBrowser.Plugins.DefaultTheme/Controls/MultiItemTile.xaml deleted file mode 100644 index 000fc95845..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/MultiItemTile.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Controls/MultiItemTile.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Controls/MultiItemTile.xaml.cs deleted file mode 100644 index 51339647a7..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Controls/MultiItemTile.xaml.cs +++ /dev/null @@ -1,219 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Net; -using MediaBrowser.UI; -using MediaBrowser.UI.Controls; -using MediaBrowser.UI.ViewModels; -using Microsoft.Expression.Media.Effects; -using System; -using System.ComponentModel; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; - -namespace MediaBrowser.Plugins.DefaultTheme.Controls -{ - /// - /// Interaction logic for MultiItemTile.xaml - /// - public partial class MultiItemTile : BaseUserControl - { - /// - /// The _image width - /// - private int _imageWidth; - /// - /// Gets or sets the width of the image. - /// - /// The width of the image. - public int ImageWidth - { - get { return _imageWidth; } - set - { - _imageWidth = value; - mainGrid.Width = value; - } - } - - /// - /// The _image height - /// - private int _imageHeight; - /// - /// Gets or sets the height of the image. - /// - /// The height of the image. - public int ImageHeight - { - get { return _imageHeight; } - set - { - _imageHeight = value; - mainGrid.Height = value; - } - } - - /// - /// The _effects - /// - TransitionEffect[] _effects = new TransitionEffect[] - { - new BlindsTransitionEffect { Orientation = BlindOrientation.Horizontal }, - new BlindsTransitionEffect { Orientation = BlindOrientation.Vertical }, - new CircleRevealTransitionEffect { }, - new FadeTransitionEffect { }, - new SlideInTransitionEffect { SlideDirection= SlideDirection.TopToBottom}, - new SlideInTransitionEffect { SlideDirection= SlideDirection.RightToLeft}, - new WipeTransitionEffect { WipeDirection = WipeDirection.RightToLeft}, - new WipeTransitionEffect { WipeDirection = WipeDirection.TopLeftToBottomRight} - }; - - /// - /// Gets or sets the random. - /// - /// The random. - private Random Random { get; set; } - - /// - /// Gets the collection. - /// - /// The collection. - public ItemCollectionViewModel Collection - { - get { return DataContext as ItemCollectionViewModel; } - } - - /// - /// Initializes a new instance of the class. - /// - public MultiItemTile() - { - InitializeComponent(); - - Random = new Random(Guid.NewGuid().GetHashCode()); - - mainGrid.Width = ImageWidth; - mainGrid.Height = ImageHeight; - DataContextChanged += BaseItemTile_DataContextChanged; - } - - /// - /// Handles the DataContextChanged event of the BaseItemTile control. - /// - /// The source of the event. - /// The instance containing the event data. - void BaseItemTile_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) - { - OnCurrentItemChanged(); - - if (Collection != null) - { - Collection.PropertyChanged += Collection_PropertyChanged; - } - } - - /// - /// Handles the PropertyChanged event of the Collection control. - /// - /// The source of the event. - /// The instance containing the event data. - void Collection_PropertyChanged(object sender, PropertyChangedEventArgs e) - { - if (e.PropertyName.Equals("CurrentItem")) - { - OnCurrentItemChanged(); - } - } - - /// - /// Called when [current item changed]. - /// - private async void OnCurrentItemChanged() - { - if (Collection == null) - { - // Setting this to null doesn't seem to clear out the content - transitionControl.Content = new FrameworkElement(); - txtName.Text = null; - return; - } - - var currentItem = Collection.CurrentItem; - - if (currentItem == null) - { - // Setting this to null doesn't seem to clear out the content - transitionControl.Content = new FrameworkElement(); - txtName.Text = Collection.Name; - return; - } - - var img = new Image - { - Stretch = Stretch.Uniform, - Width = ImageWidth, - Height = ImageHeight - }; - - var url = GetImageSource(currentItem); - - if (!string.IsNullOrEmpty(url)) - { - try - { - img.Source = await App.Instance.GetRemoteBitmapAsync(url); - txtName.Text = Collection.Name ?? currentItem.Name; - } - catch (HttpException) - { - } - } - - transitionControl.TransitionType = _effects[Random.Next(0, _effects.Length)]; - transitionControl.Content = img; - } - - /// - /// Gets the image source. - /// - /// The item. - /// Uri. - private string GetImageSource(BaseItemDto item) - { - if (item != null) - { - if (item.BackdropCount > 0) - { - return App.Instance.ApiClient.GetImageUrl(item, new ImageOptions - { - ImageType = ImageType.Backdrop, - Height = ImageHeight, - Width = ImageWidth - }); - } - - if (item.HasThumb) - { - return App.Instance.ApiClient.GetImageUrl(item, new ImageOptions - { - ImageType = ImageType.Thumb, - Height = ImageHeight, - Width = ImageWidth - }); - } - - if (item.HasPrimaryImage) - { - return App.Instance.ApiClient.GetImageUrl(item, new ImageOptions - { - ImageType = ImageType.Primary, - Height = ImageHeight - }); - } - } - - return null; - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Converters/WeatherImageConverter.cs b/MediaBrowser.Plugins.DefaultTheme/Converters/WeatherImageConverter.cs deleted file mode 100644 index aeb8f60cef..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Converters/WeatherImageConverter.cs +++ /dev/null @@ -1,48 +0,0 @@ -using MediaBrowser.Model.Weather; -using System; -using System.Globalization; -using System.Windows.Data; - -namespace MediaBrowser.Plugins.DefaultTheme.Converters -{ - /// - /// Generates a weather image based on the current forecast - /// - public class WeatherImageConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - var weather = value as WeatherInfo; - - if (weather != null && weather.CurrentWeather != null) - { - switch (weather.CurrentWeather.Condition) - { - case WeatherConditions.Thunderstorm: - return "../Resources/Images/Weather/Thunder.png"; - case WeatherConditions.Overcast: - return "../Resources/Images/Weather/Overcast.png"; - case WeatherConditions.Mist: - case WeatherConditions.Sleet: - case WeatherConditions.Rain: - return "../Resources/Images/Weather/Rain.png"; - case WeatherConditions.Blizzard: - case WeatherConditions.Snow: - return "../Resources/Images/Weather/Snow.png"; - case WeatherConditions.Cloudy: - return "../Resources/Images/Weather/Cloudy.png"; - case WeatherConditions.PartlyCloudy: - return "../Resources/Images/Weather/PartlyCloudy.png"; - default: - return "../Resources/Images/Weather/Sunny.png"; - } - } - return null; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/BaseDisplayPreferencesPage.cs b/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/BaseDisplayPreferencesPage.cs deleted file mode 100644 index b261ae0c2e..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/BaseDisplayPreferencesPage.cs +++ /dev/null @@ -1,25 +0,0 @@ -using MediaBrowser.UI.Pages; - -namespace MediaBrowser.Plugins.DefaultTheme.DisplayPreferences -{ - /// - /// Class BaseDisplayPreferencesPage - /// - public class BaseDisplayPreferencesPage : BasePage - { - /// - /// Gets or sets the display preferences window. - /// - /// The display preferences window. - public DisplayPreferencesMenu DisplayPreferencesWindow { get; set; } - - /// - /// Gets the main page. - /// - /// The main page. - protected BaseListPage MainPage - { - get { return DisplayPreferencesWindow.MainPage; } - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/DisplayPreferencesMenu.xaml b/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/DisplayPreferencesMenu.xaml deleted file mode 100644 index 62dea39cd7..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/DisplayPreferencesMenu.xaml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Close - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/DisplayPreferencesMenu.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/DisplayPreferencesMenu.xaml.cs deleted file mode 100644 index 04e65cd429..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/DisplayPreferencesMenu.xaml.cs +++ /dev/null @@ -1,92 +0,0 @@ -using MediaBrowser.UI.Controls; -using MediaBrowser.UI.Pages; -using System.Windows; - -namespace MediaBrowser.Plugins.DefaultTheme.DisplayPreferences -{ - /// - /// Interaction logic for DisplayPreferencesMenu.xaml - /// - public partial class DisplayPreferencesMenu : BaseModalWindow - { - /// - /// Gets or sets the main page. - /// - /// The main page. - public BaseListPage MainPage { get; set; } - /// - /// Gets or sets the folder id. - /// - /// The folder id. - public string FolderId { get; set; } - - /// - /// Initializes a new instance of the class. - /// - public DisplayPreferencesMenu() - { - InitializeComponent(); - - btnClose.Click += btnClose_Click; - } - - /// - /// Handles the Click event of the btnClose control. - /// - /// The source of the event. - /// The instance containing the event data. - void btnClose_Click(object sender, RoutedEventArgs e) - { - CloseModal(); - } - - /// - /// Closes the modal. - /// - protected override void CloseModal() - { - if (PageFrame.CanGoBack) - { - PageFrame.GoBackWithTransition(); - } - else - { - base.CloseModal(); - } - } - - /// - /// Called when [loaded]. - /// - protected override void OnLoaded() - { - base.OnLoaded(); - - PageFrame.Navigate(new MainPage { DisplayPreferencesWindow = this }); - } - - /// - /// Navigates to view menu. - /// - public void NavigateToViewMenu() - { - PageFrame.NavigateWithTransition(new ViewMenuPage { DisplayPreferencesWindow = this }); - } - - /// - /// Navigates to index menu. - /// - public void NavigateToIndexMenu() - { - PageFrame.NavigateWithTransition(new IndexMenuPage { DisplayPreferencesWindow = this }); - } - - /// - /// Navigates to sort menu. - /// - public void NavigateToSortMenu() - { - PageFrame.NavigateWithTransition(new SortMenuPage { DisplayPreferencesWindow = this }); - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/IndexMenuPage.xaml b/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/IndexMenuPage.xaml deleted file mode 100644 index dc7f30ccda..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/IndexMenuPage.xaml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - Index By - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/IndexMenuPage.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/IndexMenuPage.xaml.cs deleted file mode 100644 index 63fa1b84dd..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/IndexMenuPage.xaml.cs +++ /dev/null @@ -1,95 +0,0 @@ -using MediaBrowser.Model.Net; -using MediaBrowser.UI; -using MediaBrowser.UI.Controls; -using System; -using System.Windows; -using System.Windows.Controls; - -namespace MediaBrowser.Plugins.DefaultTheme.DisplayPreferences -{ - /// - /// Interaction logic for IndexMenuPage.xaml - /// - public partial class IndexMenuPage : BaseDisplayPreferencesPage - { - /// - /// Initializes a new instance of the class. - /// - public IndexMenuPage() - { - InitializeComponent(); - - chkRememberIndex.Click += chkRememberIndex_Click; - } - - /// - /// Handles the Click event of the chkRememberIndex control. - /// - /// The source of the event. - /// The instance containing the event data. - async void chkRememberIndex_Click(object sender, RoutedEventArgs e) - { - try - { - await MainPage.UpdateRememberIndex(chkRememberIndex.IsChecked.HasValue && chkRememberIndex.IsChecked.Value); - } - catch (HttpException) - { - App.Instance.ShowDefaultErrorMessage(); - } - } - - /// - /// Called when [loaded]. - /// - protected override void OnLoaded() - { - chkRememberIndex.IsChecked = MainPage.DisplayPreferences.RememberIndexing; - - var index = 0; - - var currentValue = MainPage.IndexBy ?? string.Empty; - - foreach (var option in MainPage.Folder.IndexOptions) - { - var radio = new ExtendedRadioButton { GroupName = "Options" }; - - radio.SetResourceReference(StyleProperty, "ViewMenuRadioButton"); - - var textblock = new TextBlock { Text = option }; - - textblock.SetResourceReference(StyleProperty, "TextBlockStyle"); - - radio.Content = textblock; - - if (string.IsNullOrEmpty(MainPage.DisplayPreferences.IndexBy)) - { - radio.IsChecked = index == 0; - } - else - { - radio.IsChecked = currentValue.Equals(option, StringComparison.OrdinalIgnoreCase); - } - - radio.Tag = option; - radio.Click += radio_Click; - - pnlOptions.Children.Add(radio); - - index++; - } - - base.OnLoaded(); - } - - /// - /// Handles the Click event of the radio control. - /// - /// The source of the event. - /// The instance containing the event data. - async void radio_Click(object sender, RoutedEventArgs e) - { - await MainPage.UpdateIndexOption((sender as RadioButton).Tag.ToString()); - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/MainPage.xaml b/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/MainPage.xaml deleted file mode 100644 index a8a8ca5770..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/MainPage.xaml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Display Options - - - - - View Menu - - - - - - Sort Menu - - - - - - Index Menu - - - - - - Increase Image Size - - - - - - Decrease Image Size - - - - - - Scroll: Vertical - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/MainPage.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/MainPage.xaml.cs deleted file mode 100644 index ffe269f770..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/MainPage.xaml.cs +++ /dev/null @@ -1,118 +0,0 @@ -using MediaBrowser.Model.Entities; -using System.Windows; - -namespace MediaBrowser.Plugins.DefaultTheme.DisplayPreferences -{ - /// - /// Interaction logic for MainPage.xaml - /// - public partial class MainPage : BaseDisplayPreferencesPage - { - /// - /// Initializes a new instance of the class. - /// - public MainPage() - { - InitializeComponent(); - - btnScroll.Click += btnScroll_Click; - btnIncrease.Click += btnIncrease_Click; - btnDecrease.Click += btnDecrease_Click; - ViewMenuButton.Click += ViewMenuButton_Click; - SortMenuButton.Click += SortMenuButton_Click; - IndexMenuButton.Click += IndexMenuButton_Click; - } - - /// - /// Handles the Click event of the IndexMenuButton control. - /// - /// The source of the event. - /// The instance containing the event data. - void IndexMenuButton_Click(object sender, RoutedEventArgs e) - { - DisplayPreferencesWindow.NavigateToIndexMenu(); - } - - /// - /// Handles the Click event of the SortMenuButton control. - /// - /// The source of the event. - /// The instance containing the event data. - void SortMenuButton_Click(object sender, RoutedEventArgs e) - { - DisplayPreferencesWindow.NavigateToSortMenu(); - } - - /// - /// Called when [loaded]. - /// - protected override void OnLoaded() - { - base.OnLoaded(); - - UpdateFields(); - } - - /// - /// Handles the Click event of the ViewMenuButton control. - /// - /// The source of the event. - /// The instance containing the event data. - void ViewMenuButton_Click(object sender, RoutedEventArgs e) - { - DisplayPreferencesWindow.NavigateToViewMenu(); - } - - /// - /// Handles the Click event of the btnDecrease control. - /// - /// The source of the event. - /// The instance containing the event data. - void btnDecrease_Click(object sender, RoutedEventArgs e) - { - MainPage.DisplayPreferences.DecreaseImageSize(); - MainPage.NotifyDisplayPreferencesChanged(); - } - - /// - /// Handles the Click event of the btnIncrease control. - /// - /// The source of the event. - /// The instance containing the event data. - void btnIncrease_Click(object sender, RoutedEventArgs e) - { - MainPage.DisplayPreferences.IncreaseImageSize(); - MainPage.NotifyDisplayPreferencesChanged(); - } - - /// - /// Handles the Click event of the btnScroll control. - /// - /// The source of the event. - /// The instance containing the event data. - void btnScroll_Click(object sender, RoutedEventArgs e) - { - MainPage.DisplayPreferences.ScrollDirection = MainPage.DisplayPreferences.ScrollDirection == ScrollDirection.Horizontal - ? ScrollDirection.Vertical - : ScrollDirection.Horizontal; - - MainPage.NotifyDisplayPreferencesChanged(); - - UpdateFields(); - } - - /// - /// Updates the fields. - /// - private void UpdateFields() - { - var displayPreferences = MainPage.DisplayPreferences; - - btnScroll.Visibility = displayPreferences.ViewType == ViewTypes.Poster - ? Visibility.Visible - : Visibility.Collapsed; - - txtScrollDirection.Text = displayPreferences.ScrollDirection == ScrollDirection.Horizontal ? "Scroll: Horizontal" : "Scroll: Vertical"; - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/SortMenuPage.xaml b/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/SortMenuPage.xaml deleted file mode 100644 index 35ea6e13dc..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/SortMenuPage.xaml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - Sort By - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/SortMenuPage.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/SortMenuPage.xaml.cs deleted file mode 100644 index 6d6068d167..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/SortMenuPage.xaml.cs +++ /dev/null @@ -1,95 +0,0 @@ -using MediaBrowser.Model.Net; -using MediaBrowser.UI; -using MediaBrowser.UI.Controls; -using System; -using System.Windows; -using System.Windows.Controls; - -namespace MediaBrowser.Plugins.DefaultTheme.DisplayPreferences -{ - /// - /// Interaction logic for SortMenuPage.xaml - /// - public partial class SortMenuPage : BaseDisplayPreferencesPage - { - /// - /// Initializes a new instance of the class. - /// - public SortMenuPage() - { - InitializeComponent(); - - chkRemember.Click += chkRemember_Click; - } - - /// - /// Handles the Click event of the chkRemember control. - /// - /// The source of the event. - /// The instance containing the event data. - async void chkRemember_Click(object sender, RoutedEventArgs e) - { - try - { - await MainPage.UpdateRememberSort(chkRemember.IsChecked.HasValue && chkRemember.IsChecked.Value); - } - catch (HttpException) - { - App.Instance.ShowDefaultErrorMessage(); - } - } - - /// - /// Called when [loaded]. - /// - protected override void OnLoaded() - { - chkRemember.IsChecked = MainPage.DisplayPreferences.RememberSorting; - - var index = 0; - - var currentValue = MainPage.SortBy ?? string.Empty; - - foreach (var option in MainPage.Folder.SortOptions) - { - var radio = new ExtendedRadioButton { GroupName = "Options" }; - - radio.SetResourceReference(StyleProperty, "ViewMenuRadioButton"); - - var textblock = new TextBlock { Text = option }; - - textblock.SetResourceReference(StyleProperty, "TextBlockStyle"); - - radio.Content = textblock; - - if (string.IsNullOrEmpty(MainPage.DisplayPreferences.SortBy)) - { - radio.IsChecked = index == 0; - } - else - { - radio.IsChecked = currentValue.Equals(option, StringComparison.OrdinalIgnoreCase); - } - - radio.Tag = option; - radio.Click += radio_Click; - - pnlOptions.Children.Add(radio); - - index++; - } - - base.OnLoaded(); - } - - /// - /// Handles the Click event of the radio control. - /// - /// The source of the event. - /// The instance containing the event data. - async void radio_Click(object sender, RoutedEventArgs e) - { - await MainPage.UpdateSortOption((sender as RadioButton).Tag.ToString()); - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/ViewMenuPage.xaml b/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/ViewMenuPage.xaml deleted file mode 100644 index cc4114e7af..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/ViewMenuPage.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - Select View - - Cover Flow - - - List - - - Poster - - - Thumbstrip - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/ViewMenuPage.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/ViewMenuPage.xaml.cs deleted file mode 100644 index e164809cf1..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/DisplayPreferences/ViewMenuPage.xaml.cs +++ /dev/null @@ -1,94 +0,0 @@ -using MediaBrowser.Model.Entities; -using System.Windows; - -namespace MediaBrowser.Plugins.DefaultTheme.DisplayPreferences -{ - /// - /// Interaction logic for ViewMenuPage.xaml - /// - public partial class ViewMenuPage : BaseDisplayPreferencesPage - { - /// - /// Initializes a new instance of the class. - /// - public ViewMenuPage() - { - InitializeComponent(); - - radioCoverFlow.Click += radioCoverFlow_Click; - radioList.Click += radioList_Click; - radioPoster.Click += radioPoster_Click; - radioThumbstrip.Click += radioThumbstrip_Click; - } - - /// - /// Called when [loaded]. - /// - protected override void OnLoaded() - { - base.OnLoaded(); - - UpdateFields(); - } - - /// - /// Handles the Click event of the radioThumbstrip control. - /// - /// The source of the event. - /// The instance containing the event data. - void radioThumbstrip_Click(object sender, RoutedEventArgs e) - { - MainPage.DisplayPreferences.ScrollDirection = ScrollDirection.Horizontal; - MainPage.DisplayPreferences.ViewType = ViewTypes.ThumbStrip; - MainPage.NotifyDisplayPreferencesChanged(); - } - - /// - /// Handles the Click event of the radioPoster control. - /// - /// The source of the event. - /// The instance containing the event data. - void radioPoster_Click(object sender, RoutedEventArgs e) - { - MainPage.DisplayPreferences.ViewType = ViewTypes.Poster; - MainPage.NotifyDisplayPreferencesChanged(); - } - - /// - /// Handles the Click event of the radioList control. - /// - /// The source of the event. - /// The instance containing the event data. - void radioList_Click(object sender, RoutedEventArgs e) - { - MainPage.DisplayPreferences.ScrollDirection = ScrollDirection.Vertical; - MainPage.DisplayPreferences.ViewType = ViewTypes.List; - MainPage.NotifyDisplayPreferencesChanged(); - } - - /// - /// Handles the Click event of the radioCoverFlow control. - /// - /// The source of the event. - /// The instance containing the event data. - void radioCoverFlow_Click(object sender, RoutedEventArgs e) - { - MainPage.DisplayPreferences.ScrollDirection = ScrollDirection.Horizontal; - MainPage.DisplayPreferences.ViewType = ViewTypes.CoverFlow; - MainPage.NotifyDisplayPreferencesChanged(); - } - - /// - /// Updates the fields. - /// - private void UpdateFields() - { - var displayPreferences = MainPage.DisplayPreferences; - - radioCoverFlow.IsChecked = displayPreferences.ViewType == ViewTypes.CoverFlow; - radioList.IsChecked = displayPreferences.ViewType == ViewTypes.List; - radioPoster.IsChecked = displayPreferences.ViewType == ViewTypes.Poster; - radioThumbstrip.IsChecked = displayPreferences.ViewType == ViewTypes.ThumbStrip; - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/MediaBrowser.Plugins.DefaultTheme.csproj b/MediaBrowser.Plugins.DefaultTheme/MediaBrowser.Plugins.DefaultTheme.csproj deleted file mode 100644 index f0176049d3..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/MediaBrowser.Plugins.DefaultTheme.csproj +++ /dev/null @@ -1,354 +0,0 @@ - - - - - Debug - AnyCPU - {6E892999-711D-4E24-8BAC-DACF5BFA783A} - library - Properties - MediaBrowser.Plugins.DefaultTheme - MediaBrowser.Plugins.DefaultTheme - v4.5 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - 5.2.30810.0 - ..\ - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - Always - - - - False - ..\ThirdParty\Expression\Microsoft.Expression.Effects.dll - - - False - ..\ThirdParty\Expression\Microsoft.Expression.Interactions.dll - - - - - - - - - - - - 4.0 - - - - - - - - BaseItemTile.xaml - - - - ItemChapters.xaml - - - ItemGallery.xaml - - - ItemMediaInfo.xaml - - - ItemOverview.xaml - - - ItemPerformers.xaml - - - ItemSpecialFeatures.xaml - - - ItemTrailers.xaml - - - MediaStreamControl.xaml - - - HomePageTile.xaml - - - MultiItemTile.xaml - - - - DisplayPreferencesMenu.xaml - - - IndexMenuPage.xaml - - - MainPage.xaml - - - SortMenuPage.xaml - - - ViewMenuPage.xaml - - - DetailPage.xaml - - - HomePage.xaml - - - InternalPlayerPage.xaml - - - ListPage.xaml - - - LoginPage.xaml - - - WeatherPage.xaml - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - {921c0f64-fda7-4e9f-9e73-0cb0eedb2422} - MediaBrowser.ApiInteraction - - - {9142eefa-7570-41e1-bfcc-468bb571af2f} - MediaBrowser.Common - - - {7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b} - MediaBrowser.Model - - - {1adfe460-fd95-46fa-8871-cccb4b62e2e8} - MediaBrowser.UI.Controls - - - {b5ece1fb-618e-420b-9a99-8e972d76920a} - MediaBrowser.UI - - - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - true - - - Designer - MSBuild:Compile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - xcopy "$(TargetPath)" "$(SolutionDir)\MediaBrowser.UI\CorePlugins\" /y - - - - \ No newline at end of file diff --git a/MediaBrowser.Plugins.DefaultTheme/Model/VirtualCollection.cs b/MediaBrowser.Plugins.DefaultTheme/Model/VirtualCollection.cs deleted file mode 100644 index 9bdf611296..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Model/VirtualCollection.cs +++ /dev/null @@ -1,90 +0,0 @@ -using MediaBrowser.Model.DTO; -using MediaBrowser.UI.Controls; -using System; -using System.Threading; -using System.Windows; - -namespace MediaBrowser.Plugins.DefaultTheme.Model -{ - public class VirtualCollection : ModelItem, IDisposable - { - private string _name; - public string Name - { - get { return _name; } - set - { - _name = value; - OnPropertyChanged("Name"); - } - } - - private DtoBaseItem[] _items; - public DtoBaseItem[] Items - { - get { return _items; } - set - { - _items = value; - OnPropertyChanged("Items"); - CurrentItemIndex = Items.Length == 0 ? -1 : 0; - - ReloadTimer(); - } - } - - private int _currentItemIndex; - public int CurrentItemIndex - { - get { return _currentItemIndex; } - set - { - _currentItemIndex = value; - OnPropertyChanged("CurrentItemIndex"); - OnPropertyChanged("CurrentItem"); - } - } - - public DtoBaseItem CurrentItem - { - get { return CurrentItemIndex == -1 ? null : Items[CurrentItemIndex]; } - } - - private Timer CurrentItemTimer { get; set; } - - private void DisposeTimer() - { - if (CurrentItemTimer != null) - { - CurrentItemTimer.Dispose(); - } - } - - private void ReloadTimer() - { - DisposeTimer(); - - if (Items.Length > 0) - { - CurrentItemTimer = new Timer(state => Application.Current.Dispatcher.InvokeAsync(() => IncrementCurrentItemIndex()), null, 5000, 5000); - } - } - - private void IncrementCurrentItemIndex() - { - var newIndex = CurrentItemIndex + 1; - - if (newIndex >= Items.Length) - { - newIndex = 0; - } - - CurrentItemIndex = newIndex; - } - - public void Dispose() - { - DisposeTimer(); - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Pages/DetailPage.xaml b/MediaBrowser.Plugins.DefaultTheme/Pages/DetailPage.xaml deleted file mode 100644 index 1d554e8d94..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Pages/DetailPage.xaml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - overview - - - - - media info - - - - - scenes - - - - - trailers - - - - - special features - - - - - performers - - - - - gallery - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Pages/DetailPage.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Pages/DetailPage.xaml.cs deleted file mode 100644 index e907ca6a05..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Pages/DetailPage.xaml.cs +++ /dev/null @@ -1,268 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Net; -using MediaBrowser.Plugins.DefaultTheme.Controls.Details; -using MediaBrowser.Plugins.DefaultTheme.Resources; -using MediaBrowser.UI; -using MediaBrowser.UI.Controller; -using MediaBrowser.UI.Pages; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media.Imaging; - -namespace MediaBrowser.Plugins.DefaultTheme.Pages -{ - /// - /// Interaction logic for DetailPage.xaml - /// - public partial class DetailPage : BaseDetailPage - { - /// - /// Initializes a new instance of the class. - /// - /// The item id. - public DetailPage(string itemId) - : base(itemId) - { - InitializeComponent(); - - BtnOverview.Click += BtnOverview_Click; - BtnChapters.Click += BtnChapters_Click; - BtnMediaInfo.Click += BtnDetails_Click; - BtnPerformers.Click += BtnPerformers_Click; - BtnTrailers.Click += BtnTrailers_Click; - BtnSpecialFeatures.Click += BtnSpecialFeatures_Click; - BtnGallery.Click += BtnGallery_Click; - } - - /// - /// Handles the Click event of the BtnGallery control. - /// - /// The source of the event. - /// The instance containing the event data. - void BtnGallery_Click(object sender, RoutedEventArgs e) - { - PrimaryImageGrid.Visibility = Visibility.Collapsed; - ShowDetailControl(BtnGallery, new ItemGallery { }); - } - - /// - /// Handles the Click event of the BtnSpecialFeatures control. - /// - /// The source of the event. - /// The instance containing the event data. - void BtnSpecialFeatures_Click(object sender, RoutedEventArgs e) - { - PrimaryImageGrid.Visibility = Visibility.Collapsed; - ShowDetailControl(BtnSpecialFeatures, new ItemSpecialFeatures { }); - } - - /// - /// Handles the Click event of the BtnTrailers control. - /// - /// The source of the event. - /// The instance containing the event data. - void BtnTrailers_Click(object sender, RoutedEventArgs e) - { - PrimaryImageGrid.Visibility = Visibility.Collapsed; - ShowDetailControl(BtnTrailers, new ItemTrailers { }); - } - - /// - /// Handles the Click event of the BtnDetails control. - /// - /// The source of the event. - /// The instance containing the event data. - void BtnDetails_Click(object sender, RoutedEventArgs e) - { - PrimaryImageGrid.Visibility = Visibility.Visible; - ShowDetailControl(BtnMediaInfo, new ItemMediaInfo { }); - } - - /// - /// Handles the Click event of the BtnChapters control. - /// - /// The source of the event. - /// The instance containing the event data. - void BtnChapters_Click(object sender, RoutedEventArgs e) - { - PrimaryImageGrid.Visibility = Visibility.Collapsed; - ShowDetailControl(BtnChapters, new ItemChapters { }); - } - - /// - /// Handles the Click event of the BtnOverview control. - /// - /// The source of the event. - /// The instance containing the event data. - void BtnOverview_Click(object sender, RoutedEventArgs e) - { - PrimaryImageGrid.Visibility = Visibility.Visible; - ShowDetailControl(BtnOverview, new ItemOverview { }); - } - - /// - /// Handles the Click event of the BtnPerformers control. - /// - /// The source of the event. - /// The instance containing the event data. - void BtnPerformers_Click(object sender, RoutedEventArgs e) - { - PrimaryImageGrid.Visibility = Visibility.Collapsed; - ShowDetailControl(BtnPerformers, new ItemPerformers { }); - } - - /// - /// Handles the Click event of the BtnQueue control. - /// - /// The source of the event. - /// The instance containing the event data. - void BtnQueue_Click(object sender, RoutedEventArgs e) - { - Queue(); - } - - /// - /// Called when [loaded]. - /// - protected override async void OnLoaded() - { - base.OnLoaded(); - - if (Item != null) - { - await AppResources.Instance.SetPageTitle(Item); - } - } - - /// - /// Called when [item changed]. - /// - protected override async void OnItemChanged() - { - base.OnItemChanged(); - - var pageTitleTask = AppResources.Instance.SetPageTitle(Item); - - BtnOverview_Click(null, null); - - RenderItem(); - - await pageTitleTask; - } - - /// - /// Renders the item. - /// - private async void RenderItem() - { - Task primaryImageTask = null; - - if (Item.HasPrimaryImage) - { - PrimaryImage.Visibility = Visibility.Visible; - - primaryImageTask = App.Instance.GetRemoteBitmapAsync(UIKernel.Instance.ApiClient.GetImageUrl(Item, new ImageOptions - { - ImageType = ImageType.Primary, - Quality = 100 - })); - } - else - { - SetDefaultImage(); - } - - if (Item.IsType("movie") || Item.IsType("trailer")) - { - TxtName.Visibility = Visibility.Collapsed; - } - else - { - var name = Item.Name; - - if (Item.IndexNumber.HasValue) - { - name = Item.IndexNumber.Value + " - " + name; - - if (Item.ParentIndexNumber.HasValue) - { - name = Item.ParentIndexNumber.Value + "." + name; - } - } - TxtName.Text = name; - - TxtName.Visibility = Visibility.Visible; - } - - if (Item.Taglines != null && Item.Taglines.Count > 0) - { - Tagline.Visibility = Visibility.Visible; - - Tagline.Text = Item.Taglines[0]; - } - else - { - Tagline.Visibility = Visibility.Collapsed; - } - - BtnGallery.Visibility = ItemGallery.GetImages(Item).Count > 0 ? Visibility.Visible : Visibility.Collapsed; - BtnTrailers.Visibility = Item.HasTrailer ? Visibility.Visible : Visibility.Collapsed; - BtnSpecialFeatures.Visibility = Item.SpecialFeatureCount > 0 ? Visibility.Visible : Visibility.Collapsed; - BtnPerformers.Visibility = Item.People != null && Item.People.Length > 0 ? Visibility.Visible : Visibility.Collapsed; - BtnChapters.Visibility = Item.Chapters != null && Item.Chapters.Count > 0 ? Visibility.Visible : Visibility.Collapsed; - - if (primaryImageTask != null) - { - try - { - PrimaryImage.Source = await primaryImageTask; - } - catch (HttpException) - { - SetDefaultImage(); - } - } - } - - /// - /// Sets the default image. - /// - private void SetDefaultImage() - { - PrimaryImage.Visibility = Visibility.Collapsed; - } - - /// - /// Handles the 1 event of the Button_Click control. - /// - /// The source of the event. - /// The instance containing the event data. - private void Button_Click_1(object sender, RoutedEventArgs e) - { - Play(); - } - - /// - /// Handles the 2 event of the Button_Click control. - /// - /// The source of the event. - /// The instance containing the event data. - private async void Button_Click_2(object sender, RoutedEventArgs e) - { - await UIKernel.Instance.PlaybackManager.StopAllPlayback(); - } - - /// - /// Shows the detail control. - /// - /// The button. - /// The element. - private void ShowDetailControl(Button button, BaseDetailsControl element) - { - DetailContent.Content = element; - element.Item = Item; - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Pages/HomePage.xaml b/MediaBrowser.Plugins.DefaultTheme/Pages/HomePage.xaml deleted file mode 100644 index 5ac73b2b3b..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Pages/HomePage.xaml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Pages/HomePage.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Pages/HomePage.xaml.cs deleted file mode 100644 index 719a31f34e..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Pages/HomePage.xaml.cs +++ /dev/null @@ -1,442 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Net; -using MediaBrowser.Plugins.DefaultTheme.Resources; -using MediaBrowser.UI; -using MediaBrowser.UI.Controls; -using MediaBrowser.UI.Pages; -using MediaBrowser.UI.ViewModels; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace MediaBrowser.Plugins.DefaultTheme.Pages -{ - /// - /// Interaction logic for HomePage.xaml - /// - public partial class HomePage : BaseHomePage - { - /// - /// Initializes a new instance of the class. - /// - public HomePage() - { - InitializeComponent(); - - lstCollectionFolders.ItemInvoked += lstCollectionFolders_ItemInvoked; - } - - /// - /// The _favorite items - /// - private ItemCollectionViewModel _favoriteItems; - /// - /// Gets or sets the favorite items. - /// - /// The favorite items. - public ItemCollectionViewModel FavoriteItems - { - get { return _favoriteItems; } - - set - { - _favoriteItems = value; - OnPropertyChanged("FavoriteItems"); - } - } - - /// - /// The _resumable items - /// - private ItemCollectionViewModel _resumableItems; - /// - /// Gets or sets the resumable items. - /// - /// The resumable items. - public ItemCollectionViewModel ResumableItems - { - get { return _resumableItems; } - - set - { - _resumableItems = value; - OnPropertyChanged("ResumableItems"); - } - } - - /// - /// The _recently added items - /// - private ItemCollectionViewModel _recentlyAddedItems; - /// - /// Gets or sets the recently added items. - /// - /// The recently added items. - public ItemCollectionViewModel RecentlyAddedItems - { - get { return _recentlyAddedItems; } - - set - { - _recentlyAddedItems = value; - OnPropertyChanged("RecentlyAddedItems"); - } - } - - /// - /// The _recently played items - /// - private ItemCollectionViewModel _recentlyPlayedItems; - /// - /// Gets or sets the recently played items. - /// - /// The recently played items. - public ItemCollectionViewModel RecentlyPlayedItems - { - get { return _recentlyPlayedItems; } - - set - { - _recentlyPlayedItems = value; - OnPropertyChanged("RecentlyPlayedItems"); - } - } - - /// - /// The _spotlight items - /// - private ItemCollectionViewModel _spotlightItems; - /// - /// Gets or sets the spotlight items. - /// - /// The spotlight items. - public ItemCollectionViewModel SpotlightItems - { - get { return _spotlightItems; } - - set - { - _spotlightItems = value; - OnPropertyChanged("SpotlightItems"); - } - } - - /// - /// The _top picks - /// - private ItemCollectionViewModel _topPicks; - /// - /// Gets or sets the top picks. - /// - /// The top picks. - public ItemCollectionViewModel TopPicks - { - get { return _topPicks; } - - set - { - _topPicks = value; - OnPropertyChanged("TopPicks"); - } - } - - /// - /// LSTs the collection folders_ item invoked. - /// - /// The sender. - /// The e. - void lstCollectionFolders_ItemInvoked(object sender, ItemEventArgs e) - { - var model = e.Argument as DtoBaseItemViewModel; - - if (model != null) - { - App.Instance.NavigateToItem(model.Item); - } - } - - /// - /// Called when [loaded]. - /// - protected override void OnLoaded() - { - base.OnLoaded(); - - AppResources.Instance.SetDefaultPageTitle(); - } - - /// - /// Gets called anytime the Folder gets refreshed - /// - protected override void OnFolderChanged() - { - base.OnFolderChanged(); - - Task.Run(() => RefreshSpecialItems()); - } - - /// - /// Refreshes the special items. - /// - /// Task. - private async Task RefreshSpecialItems() - { - var tasks = new List(); - - tasks.Add(RefreshFavoriteItemsAsync()); - - // In-Progress Items - if (Folder.ResumableItemCount > 0) - { - tasks.Add(RefreshResumableItemsAsync()); - } - else - { - SetResumableItems(new BaseItemDto[] { }); - } - - // Recently Added Items - if (Folder.RecentlyAddedItemCount > 0) - { - tasks.Add(RefreshRecentlyAddedItemsAsync()); - } - else - { - SetRecentlyAddedItems(new BaseItemDto[] { }); - } - - // Recently Played Items - if (Folder.RecentlyPlayedItemCount > 0) - { - tasks.Add(RefreshRecentlyPlayedItemsAsync()); - } - else - { - SetRecentlyPlayedItems(new BaseItemDto[] { }); - } - - tasks.Add(RefreshTopPicksAsync()); - tasks.Add(RefreshSpotlightItemsAsync()); - - await Task.WhenAll(tasks).ConfigureAwait(false); - } - - /// - /// Refreshes the favorite items async. - /// - /// Task. - private async Task RefreshFavoriteItemsAsync() - { - var query = new ItemQuery - { - Filters = new[] { ItemFilter.IsFavorite }, - ImageTypes = new[] { ImageType.Backdrop, ImageType.Thumb }, - UserId = App.Instance.CurrentUser.Id, - ParentId = Folder.Id, - Limit = 10, - SortBy = new[] { ItemSortBy.Random }, - Recursive = true - }; - - try - { - var result = await App.Instance.ApiClient.GetItemsAsync(query).ConfigureAwait(false); - - SetFavoriteItems(result.Items); - } - catch (HttpException) - { - // Already logged in lower levels - // Don't allow the entire screen to fail - } - } - - /// - /// Refreshes the resumable items async. - /// - /// Task. - private async Task RefreshResumableItemsAsync() - { - var query = new ItemQuery - { - Filters = new[] { ItemFilter.IsResumable }, - ImageTypes = new[] { ImageType.Backdrop, ImageType.Thumb }, - UserId = App.Instance.CurrentUser.Id, - ParentId = Folder.Id, - Limit = 10, - SortBy = new[] { ItemSortBy.DatePlayed }, - SortOrder = SortOrder.Descending, - Recursive = true - }; - - try - { - var result = await App.Instance.ApiClient.GetItemsAsync(query).ConfigureAwait(false); - - SetResumableItems(result.Items); - } - catch (HttpException) - { - // Already logged in lower levels - // Don't allow the entire screen to fail - } - } - - /// - /// Refreshes the recently played items async. - /// - /// Task. - private async Task RefreshRecentlyPlayedItemsAsync() - { - var query = new ItemQuery - { - Filters = new[] { ItemFilter.IsRecentlyPlayed }, - ImageTypes = new[] { ImageType.Backdrop, ImageType.Thumb }, - UserId = App.Instance.CurrentUser.Id, - ParentId = Folder.Id, - Limit = 10, - SortBy = new[] { ItemSortBy.DatePlayed }, - SortOrder = SortOrder.Descending, - Recursive = true - }; - - try - { - var result = await App.Instance.ApiClient.GetItemsAsync(query).ConfigureAwait(false); - SetRecentlyPlayedItems(result.Items); - } - catch (HttpException) - { - // Already logged in lower levels - // Don't allow the entire screen to fail - } - } - - /// - /// Refreshes the recently added items async. - /// - /// Task. - private async Task RefreshRecentlyAddedItemsAsync() - { - var query = new ItemQuery - { - Filters = new[] { ItemFilter.IsRecentlyAdded, ItemFilter.IsNotFolder }, - ImageTypes = new[] { ImageType.Backdrop, ImageType.Thumb }, - UserId = App.Instance.CurrentUser.Id, - ParentId = Folder.Id, - Limit = 10, - SortBy = new[] { ItemSortBy.DateCreated }, - SortOrder = SortOrder.Descending, - Recursive = true - }; - - try - { - var result = await App.Instance.ApiClient.GetItemsAsync(query).ConfigureAwait(false); - SetRecentlyAddedItems(result.Items); - } - catch (HttpException) - { - // Already logged in lower levels - // Don't allow the entire screen to fail - } - } - - /// - /// Refreshes the top picks async. - /// - /// Task. - private async Task RefreshTopPicksAsync() - { - var query = new ItemQuery - { - ImageTypes = new[] { ImageType.Backdrop, ImageType.Thumb }, - Filters = new[] { ItemFilter.IsRecentlyAdded, ItemFilter.IsNotFolder }, - UserId = App.Instance.CurrentUser.Id, - ParentId = Folder.Id, - Limit = 10, - SortBy = new[] { ItemSortBy.Random }, - SortOrder = SortOrder.Descending, - Recursive = true - }; - - try - { - var result = await App.Instance.ApiClient.GetItemsAsync(query).ConfigureAwait(false); - - TopPicks = new ItemCollectionViewModel { Items = result.Items, Name = "Top Picks" }; - } - catch (HttpException) - { - // Already logged in lower levels - // Don't allow the entire screen to fail - } - } - - /// - /// Refreshes the spotlight items async. - /// - /// Task. - private async Task RefreshSpotlightItemsAsync() - { - var query = new ItemQuery - { - ImageTypes = new[] { ImageType.Backdrop }, - ExcludeItemTypes = new[] { "Season" }, - UserId = App.Instance.CurrentUser.Id, - ParentId = Folder.Id, - Limit = 10, - SortBy = new[] { ItemSortBy.Random }, - Recursive = true - }; - - try - { - var result = await App.Instance.ApiClient.GetItemsAsync(query).ConfigureAwait(false); - - SpotlightItems = new ItemCollectionViewModel(rotationPeriodMs: 6000, rotationDevaiationMs: 1000) { Items = result.Items }; - } - catch (HttpException) - { - // Already logged in lower levels - // Don't allow the entire screen to fail - } - } - - /// - /// Sets the favorite items. - /// - /// The items. - private void SetFavoriteItems(BaseItemDto[] items) - { - FavoriteItems = new ItemCollectionViewModel { Items = items, Name = "Favorites" }; - } - - /// - /// Sets the resumable items. - /// - /// The items. - private void SetResumableItems(BaseItemDto[] items) - { - ResumableItems = new ItemCollectionViewModel { Items = items, Name = "Resume" }; - } - - /// - /// Sets the recently played items. - /// - /// The items. - private void SetRecentlyPlayedItems(BaseItemDto[] items) - { - RecentlyPlayedItems = new ItemCollectionViewModel { Items = items, Name = "Recently Played" }; - } - - /// - /// Sets the recently added items. - /// - /// The items. - private void SetRecentlyAddedItems(BaseItemDto[] items) - { - RecentlyAddedItems = new ItemCollectionViewModel { Items = items, Name = "Recently Added" }; - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Pages/InternalPlayerPage.xaml b/MediaBrowser.Plugins.DefaultTheme/Pages/InternalPlayerPage.xaml deleted file mode 100644 index e8e4af2aa1..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Pages/InternalPlayerPage.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Pages/InternalPlayerPage.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Pages/InternalPlayerPage.xaml.cs deleted file mode 100644 index 82a1e9cf89..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Pages/InternalPlayerPage.xaml.cs +++ /dev/null @@ -1,41 +0,0 @@ -using MediaBrowser.Plugins.DefaultTheme.Resources; -using MediaBrowser.UI.Pages; -using System.Windows; - -namespace MediaBrowser.Plugins.DefaultTheme.Pages -{ - /// - /// Interaction logic for InternalPlayerPage.xaml - /// - public partial class InternalPlayerPage : BaseInternalPlayerPage - { - /// - /// Initializes a new instance of the class. - /// - public InternalPlayerPage() - { - InitializeComponent(); - } - - /// - /// Called when [loaded]. - /// - protected override void OnLoaded() - { - base.OnLoaded(); - - AppResources.Instance.ClearPageTitle(); - AppResources.Instance.HeaderContent.Visibility = Visibility.Collapsed; - } - - /// - /// Called when [unloaded]. - /// - protected override void OnUnloaded() - { - base.OnUnloaded(); - - AppResources.Instance.HeaderContent.Visibility = Visibility.Visible; - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Pages/ListPage.xaml b/MediaBrowser.Plugins.DefaultTheme/Pages/ListPage.xaml deleted file mode 100644 index 58f6db177d..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Pages/ListPage.xaml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Pages/ListPage.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Pages/ListPage.xaml.cs deleted file mode 100644 index 096ba9ea73..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Pages/ListPage.xaml.cs +++ /dev/null @@ -1,545 +0,0 @@ -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Net; -using MediaBrowser.Plugins.DefaultTheme.DisplayPreferences; -using MediaBrowser.Plugins.DefaultTheme.Resources; -using MediaBrowser.UI; -using MediaBrowser.UI.Controls; -using MediaBrowser.UI.Pages; -using System; -using System.Windows; - -namespace MediaBrowser.Plugins.DefaultTheme.Pages -{ - /// - /// Interaction logic for ListPage.xaml - /// - public partial class ListPage : BaseListPage - { - /// - /// Initializes a new instance of the class. - /// - /// The item id. - public ListPage(string itemId) - : base(itemId) - { - InitializeComponent(); - } - - /// - /// Subclasses must provide the list box that holds the items - /// - /// The items list. - protected override ExtendedListBox ItemsList - { - get - { - return lstItems; - } - } - - /// - /// If the page is using it's own image type and not honoring the DisplayPreferences setting, it should return it here - /// - /// The type of the fixed image. - protected override ImageType? FixedImageType - { - get { return ImageType.Primary; } - } - - /// - /// Called when [loaded]. - /// - protected override async void OnLoaded() - { - base.OnLoaded(); - - if (Folder != null) - { - ShowViewButton(); - - await AppResources.Instance.SetPageTitle(Folder); - } - else - { - HideViewButton(); - } - } - - /// - /// Called when [unloaded]. - /// - protected override void OnUnloaded() - { - base.OnUnloaded(); - - HideViewButton(); - } - - /// - /// Called when [property changed]. - /// - /// The name. - public override void OnPropertyChanged(string name) - { - base.OnPropertyChanged(name); - - if (name.Equals("CurrentItemIndex", StringComparison.OrdinalIgnoreCase)) - { - UpdateCurrentItemIndex(); - } - } - - /// - /// Updates the index of the current item. - /// - private void UpdateCurrentItemIndex() - { - var index = CurrentItemIndex; - - currentItemIndex.Visibility = index == -1 ? Visibility.Collapsed : Visibility.Visible; - currentItemIndex.Text = (CurrentItemIndex + 1).ToString(); - - currentItemIndexDivider.Visibility = index == -1 ? Visibility.Collapsed : Visibility.Visible; - } - - /// - /// Gets called anytime the Folder gets refreshed - /// - protected override async void OnFolderChanged() - { - base.OnFolderChanged(); - - var pageTitleTask = AppResources.Instance.SetPageTitle(Folder); - - ShowViewButton(); - - if (Folder.IsType("Season")) - { - TxtName.Visibility = Visibility.Visible; - TxtName.Text = Folder.Name; - } - else - { - TxtName.Visibility = Visibility.Collapsed; - } - - if (!string.IsNullOrEmpty(Folder.Overview) || Folder.IsType("Series") || Folder.IsType("Season")) - { - sidebar.Visibility = Visibility.Collapsed; - - //RefreshSidebar(); - } - else - { - sidebar.Visibility = Visibility.Collapsed; - } - - await pageTitleTask; - } - - /// - /// Shows the view button. - /// - private void ShowViewButton() - { - var viewButton = AppResources.Instance.ViewButton; - viewButton.Visibility = Visibility.Visible; - viewButton.Click -= ViewButton_Click; - viewButton.Click += ViewButton_Click; - } - - /// - /// Hides the view button. - /// - private void HideViewButton() - { - var viewButton = AppResources.Instance.ViewButton; - viewButton.Visibility = Visibility.Collapsed; - viewButton.Click -= ViewButton_Click; - } - - /// - /// Handles the Click event of the ViewButton control. - /// - /// The source of the event. - /// The instance containing the event data. - async void ViewButton_Click(object sender, RoutedEventArgs e) - { - var menu = new DisplayPreferencesMenu - { - FolderId = Folder.Id, - MainPage = this - }; - - menu.ShowModal(this.GetWindow()); - - try - { - await App.Instance.ApiClient.UpdateDisplayPreferencesAsync(App.Instance.CurrentUser.Id, Folder.Id, DisplayPreferences); - } - catch (HttpException) - { - App.Instance.ShowDefaultErrorMessage(); - } - } - - /// - /// Refreshes the sidebar. - /// - private void RefreshSidebar() - { - //if (Folder.BackdropCount > 0) - //{ - // //backdropImage.Source = App.Instance.GetBitmapImage(ApiClient.GetImageUrl(Folder.Id, Model.Entities.ImageType.Backdrop, width: 560, height: 315)); - // backdropImage.Visibility = Visibility.Visible; - //} - //else - //{ - // backdropImage.Source = null; - // backdropImage.Visibility = Visibility.Collapsed; - //} - } - - /// - /// Handles current item selection changes - /// - protected override void OnCurrentItemChanged() - { - base.OnCurrentItemChanged(); - - // Name - /*if (CurrentItem != null) - { - txtName.Visibility = CurrentItem.HasLogo ? Visibility.Collapsed : Visibility.Visible; - currentItemLogo.Visibility = CurrentItem.HasLogo ? Visibility.Visible : Visibility.Collapsed; - - if (CurrentItem.HasLogo) - { - var uri = ApiClient.GetImageUrl(CurrentItem.Id, ImageType.Logo, maxWidth: 400, maxHeight: 125); - - Dispatcher.InvokeAsync(() => currentItemLogo.Source = App.Instance.GetBitmapImage(new Uri(uri, UriKind.Absolute))); - } - else - { - var name = CurrentItem.Name; - - if (!CurrentItem.IsType("Season") && CurrentItem.IndexNumber.HasValue) - { - name = CurrentItem.IndexNumber + " - " + name; - } - - if (CurrentItem.IsType("Movie") && CurrentItem.ProductionYear.HasValue) - { - name += " (" + CurrentItem.ProductionYear + ")"; - } - - txtName.Text = name; - } - } - else - { - txtName.Visibility = Visibility.Collapsed; - currentItemLogo.Visibility = Visibility.Collapsed; - } - - // PremiereDate - if (CurrentItem != null && CurrentItem.PremiereDate.HasValue && !CurrentItem.IsType("Series")) - { - pnlPremiereDate.Visibility = Visibility.Visible; - - var prefix = CurrentItem.IsType("Episode") ? "Aired" : CurrentItem.IsType("Series") ? "First Aired" : "Premiered"; - - txtPremiereDate.Text = string.Format("{0} {1}", prefix, CurrentItem.PremiereDate.Value.ToShortDateString()); - } - else - { - pnlPremiereDate.Visibility = Visibility.Collapsed; - } - - // Taglines - if (CurrentItem != null && CurrentItem.Taglines != null && CurrentItem.Taglines.Length > 0) - { - txtTagLine.Visibility = Visibility.Visible; - txtTagLine.Text = CurrentItem.Taglines[0]; - } - else - { - txtTagLine.Visibility = Visibility.Collapsed; - } - - // Genres - if (CurrentItem != null && CurrentItem.Genres != null && CurrentItem.Genres.Length > 0) - { - txtGenres.Visibility = Visibility.Visible; - - // Try to keep them on one line by limiting to three - txtGenres.Text = string.Join(" / ", CurrentItem.Genres.Take(3)); - } - else - { - txtGenres.Visibility = Visibility.Collapsed; - } - - // Season Number - if (CurrentItem != null && CurrentItem.ParentIndexNumber.HasValue && CurrentItem.IsType("Episode")) - { - txtSeasonHeader.Visibility = Visibility.Visible; - - txtSeasonHeader.Text = string.Format("Season {0}", CurrentItem.ParentIndexNumber); - } - else - { - txtSeasonHeader.Visibility = Visibility.Collapsed; - } - - UpdateSeriesAirTime(); - UpdateMiscellaneousFields(); - UpdateCommunityRating(); - UpdateVideoInfo(); - UpdateAudioInfo();*/ - } - - /// - /// Updates the series air time. - /// - private void UpdateSeriesAirTime() - { - /*if (CurrentItem != null && CurrentItem.SeriesInfo != null) - { - var series = CurrentItem.SeriesInfo; - - txtSeriesAirTime.Visibility = Visibility.Visible; - - if (series.Status.HasValue && series.Status.Value == SeriesStatus.Ended) - { - txtSeriesAirTime.Text = "Ended"; - } - else - { - string txt = "Airs"; - - if (series.AirDays.Length > 0) - { - if (series.AirDays.Length == 7) - { - txt += " Everyday"; - } - else - { - txt += " " + series.AirDays[0].ToString(); - } - } - - if (CurrentItem.Studios != null && CurrentItem.Studios.Length > 0) - { - txt += " on " + CurrentItem.Studios[0].Name; - } - - if (!string.IsNullOrEmpty(series.AirTime)) - { - txt += " at " + series.AirTime; - } - - txtSeriesAirTime.Text = txt; - } - } - else - { - txtSeriesAirTime.Visibility = Visibility.Collapsed; - }*/ - } - - /// - /// Updates the miscellaneous fields. - /// - private void UpdateMiscellaneousFields() - { - /*if (CurrentItem == null) - { - pnlRuntime.Visibility = Visibility.Collapsed; - pnlOfficialRating.Visibility = Visibility.Collapsed; - } - else - { - var runtimeTicks = CurrentItem.RunTimeTicks ?? 0; - - // Runtime - if (runtimeTicks > 0) - { - pnlRuntime.Visibility = Visibility.Visible; - txtRuntime.Text = string.Format("{0} minutes", Convert.ToInt32(TimeSpan.FromTicks(runtimeTicks).TotalMinutes)); - } - else - { - pnlRuntime.Visibility = Visibility.Collapsed; - } - - pnlOfficialRating.Visibility = string.IsNullOrEmpty(CurrentItem.OfficialRating) ? Visibility.Collapsed : Visibility.Visible; - } - - // Show the parent panel only if one of the children is visible - pnlMisc.Visibility = pnlRuntime.Visibility == Visibility.Visible || - pnlOfficialRating.Visibility == Visibility.Visible - ? Visibility.Visible - : Visibility.Collapsed;*/ - } - - /// - /// Updates the community rating. - /// - private void UpdateCommunityRating() - { - /*// Community Rating - if (CurrentItem != null && CurrentItem.CommunityRating.HasValue) - { - pnlRating.Visibility = Visibility.Visible; - } - else - { - pnlRating.Visibility = Visibility.Collapsed; - return; - } - - var rating = CurrentItem.CommunityRating.Value; - - for (var i = 0; i < 10; i++) - { - if (rating < i - 1) - { - TreeHelper.FindChild(this, "communityRatingImage" + i).SetResourceReference(Image.StyleProperty, "CommunityRatingImageEmpty"); - } - else if (rating < i) - { - TreeHelper.FindChild(this, "communityRatingImage" + i).SetResourceReference(Image.StyleProperty, "CommunityRatingImageHalf"); - } - else - { - TreeHelper.FindChild(this, "communityRatingImage" + i).SetResourceReference(Image.StyleProperty, "CommunityRatingImageFull"); - } - }*/ - } - - /// - /// Updates the video info. - /// - private void UpdateVideoInfo() - { - /*if (CurrentItem != null && CurrentItem.VideoInfo != null) - { - pnlVideoInfo.Visibility = Visibility.Visible; - } - else - { - pnlVideoInfo.Visibility = Visibility.Collapsed; - return; - } - - var videoInfo = CurrentItem.VideoInfo; - - if (videoInfo.VideoType == VideoType.VideoFile) - { - txtVideoType.Text = Path.GetExtension(CurrentItem.Path).Replace(".", string.Empty).ToLower(); - } - else - { - txtVideoType.Text = videoInfo.VideoType.ToString().ToLower(); - } - - txtVideoResolution.Text = GetResolutionText(videoInfo); - pnlVideoResolution.Visibility = string.IsNullOrEmpty(txtVideoResolution.Text) ? Visibility.Collapsed : Visibility.Visible; - - if (!string.IsNullOrEmpty(videoInfo.Codec)) - { - pnlVideoCodec.Visibility = Visibility.Visible; - txtVideoCodec.Text = videoInfo.Codec.ToLower(); - } - else - { - pnlVideoCodec.Visibility = Visibility.Collapsed; - } - - var audio = videoInfo.GetDefaultAudioStream(); - - if (audio == null || string.IsNullOrEmpty(audio.Codec)) - { - pnlAudioCodec.Visibility = Visibility.Collapsed; - } - else - { - pnlAudioCodec.Visibility = Visibility.Visible; - txtAudioCodec.Text = audio.Codec.ToLower(); - }*/ - } - - /// - /// Updates the audio info. - /// - private void UpdateAudioInfo() - { - /*if (CurrentItem != null && CurrentItem.AudioInfo != null) - { - pnlAudioInfo.Visibility = Visibility.Visible; - } - else - { - pnlAudioInfo.Visibility = Visibility.Collapsed; - return; - } - - var audioInfo = CurrentItem.AudioInfo; - - txtAudioType.Text = Path.GetExtension(CurrentItem.Path).Replace(".", string.Empty).ToLower(); - - if (audioInfo.BitRate > 0) - { - pnlAudioBitrate.Visibility = Visibility.Visible; - txtAudioBitrate.Text = (audioInfo.BitRate / 1000).ToString() + "kbps"; - } - else - { - pnlAudioBitrate.Visibility = Visibility.Collapsed; - }*/ - } - - /*private string GetResolutionText(VideoInfo info) - { - var scanType = info.ScanType ?? string.Empty; - - if (info.Height == 1080) - { - if (scanType.Equals("progressive", StringComparison.OrdinalIgnoreCase)) - { - return "1080p"; - } - if (scanType.Equals("interlaced", StringComparison.OrdinalIgnoreCase)) - { - return "1080i"; - } - } - if (info.Height == 720) - { - if (scanType.Equals("progressive", StringComparison.OrdinalIgnoreCase)) - { - return "720p"; - } - if (scanType.Equals("interlaced", StringComparison.OrdinalIgnoreCase)) - { - return "720i"; - } - } - if (info.Height == 480) - { - if (scanType.Equals("progressive", StringComparison.OrdinalIgnoreCase)) - { - return "480p"; - } - if (scanType.Equals("interlaced", StringComparison.OrdinalIgnoreCase)) - { - return "480i"; - } - } - - return info.Width == 0 || info.Height == 0 ? string.Empty : info.Width + "x" + info.Height; - }*/ - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Pages/LoginPage.xaml b/MediaBrowser.Plugins.DefaultTheme/Pages/LoginPage.xaml deleted file mode 100644 index 6a9e796ee7..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Pages/LoginPage.xaml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Pages/LoginPage.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Pages/LoginPage.xaml.cs deleted file mode 100644 index 35f2c1088e..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Pages/LoginPage.xaml.cs +++ /dev/null @@ -1,43 +0,0 @@ -using MediaBrowser.Plugins.DefaultTheme.Resources; -using MediaBrowser.UI.Controls; -using MediaBrowser.UI.Pages; - -namespace MediaBrowser.Plugins.DefaultTheme.Pages -{ - /// - /// Interaction logic for LoginPage.xaml - /// - public partial class LoginPage : BaseLoginPage - { - /// - /// Initializes a new instance of the class. - /// - public LoginPage() - : base() - { - InitializeComponent(); - } - - /// - /// Subclasses must provide the list that holds the users - /// - /// The items list. - protected override ExtendedListBox ItemsList - { - get - { - return lstUsers; - } - } - - /// - /// Called when [loaded]. - /// - protected override void OnLoaded() - { - base.OnLoaded(); - - AppResources.Instance.SetDefaultPageTitle(); - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Pages/WeatherPage.xaml b/MediaBrowser.Plugins.DefaultTheme/Pages/WeatherPage.xaml deleted file mode 100644 index 17a8239e5a..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Pages/WeatherPage.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - Weather Page - - diff --git a/MediaBrowser.Plugins.DefaultTheme/Pages/WeatherPage.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Pages/WeatherPage.xaml.cs deleted file mode 100644 index eae50befbc..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Pages/WeatherPage.xaml.cs +++ /dev/null @@ -1,15 +0,0 @@ -using MediaBrowser.UI.Pages; - -namespace MediaBrowser.Plugins.DefaultTheme.Pages -{ - /// - /// Interaction logic for WeatherPage.xaml - /// - public partial class WeatherPage : BaseWeatherPage - { - public WeatherPage() - { - InitializeComponent(); - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Properties/AssemblyInfo.cs b/MediaBrowser.Plugins.DefaultTheme/Properties/AssemblyInfo.cs deleted file mode 100644 index cc3fafdc9c..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("MediaBrowser.Plugins.DefaultTheme")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("MediaBrowser.Plugins.DefaultTheme")] -[assembly: AssemblyCopyright("Copyright © 2012")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly:ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - -[assembly: Guid("411f938b-89d5-48f6-b6ab-a5d75036efcc")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.*")] diff --git a/MediaBrowser.Plugins.DefaultTheme/Properties/DesignTimeResources.xaml b/MediaBrowser.Plugins.DefaultTheme/Properties/DesignTimeResources.xaml deleted file mode 100644 index 20f1556671..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Properties/DesignTimeResources.xaml +++ /dev/null @@ -1,5 +0,0 @@ - - - \ No newline at end of file diff --git a/MediaBrowser.Plugins.DefaultTheme/Properties/Resources.Designer.cs b/MediaBrowser.Plugins.DefaultTheme/Properties/Resources.Designer.cs deleted file mode 100644 index da735391a8..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Properties/Resources.Designer.cs +++ /dev/null @@ -1,62 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.17929 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace MediaBrowser.Plugins.DefaultTheme.Properties { - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if ((resourceMan == null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediaBrowser.Plugins.DefaultTheme.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Properties/Resources.resx b/MediaBrowser.Plugins.DefaultTheme/Properties/Resources.resx deleted file mode 100644 index ffecec851a..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/MediaBrowser.Plugins.DefaultTheme/Properties/Settings.Designer.cs b/MediaBrowser.Plugins.DefaultTheme/Properties/Settings.Designer.cs deleted file mode 100644 index b99760e3f4..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.17929 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace MediaBrowser.Plugins.DefaultTheme.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/Properties/Settings.settings b/MediaBrowser.Plugins.DefaultTheme/Properties/Settings.settings deleted file mode 100644 index 8f2fd95d62..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/AppResources.cs b/MediaBrowser.Plugins.DefaultTheme/Resources/AppResources.cs deleted file mode 100644 index 3ca6e8df2b..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Resources/AppResources.cs +++ /dev/null @@ -1,223 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Net; -using MediaBrowser.UI; -using MediaBrowser.UI.Controller; -using MediaBrowser.UI.Controls; -using MediaBrowser.UI.Playback; -using MediaBrowser.UI.Playback.InternalPlayer; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; - -namespace MediaBrowser.Plugins.DefaultTheme.Resources -{ - /// - /// Class AppResources - /// - public partial class AppResources : ResourceDictionary - { - /// - /// Gets the instance. - /// - /// The instance. - public static AppResources Instance { get; private set; } - - /// - /// Initializes a new instance of the class. - /// - public AppResources() - { - InitializeComponent(); - - Instance = this; - - UIKernel.Instance.PlaybackManager.PlaybackStarted += PlaybackManager_PlaybackStarted; - UIKernel.Instance.PlaybackManager.PlaybackCompleted += PlaybackManager_PlaybackCompleted; - } - - /// - /// Handles the Click event of the NowPlayingButton control. - /// - /// The source of the event. - /// The instance containing the event data. - void NowPlaying_Click(object sender, RoutedEventArgs e) - { - App.Instance.NavigateToInternalPlayerPage(); - } - - /// - /// Handles the PlaybackCompleted event of the PlaybackManager control. - /// - /// The source of the event. - /// The instance containing the event data. - /// - void PlaybackManager_PlaybackCompleted(object sender, PlaybackStopEventArgs e) - { - App.Instance.ApplicationWindow.Dispatcher.Invoke(() => NowPlayingButton.Visibility = Visibility.Collapsed); - } - - /// - /// Handles the PlaybackStarted event of the PlaybackManager control. - /// - /// The source of the event. - /// The instance containing the event data. - void PlaybackManager_PlaybackStarted(object sender, PlaybackEventArgs e) - { - if (e.Player is BaseInternalMediaPlayer) - { - App.Instance.ApplicationWindow.Dispatcher.Invoke(() => NowPlayingButton.Visibility = Visibility.Visible); - } - } - - /// - /// Weathers the button click. - /// - /// The sender. - /// The instance containing the event data. - void WeatherButtonClick(object sender, RoutedEventArgs e) - { - App.Instance.DisplayWeather(); - } - - /// - /// Settingses the button click. - /// - /// The sender. - /// The instance containing the event data. - void SettingsButtonClick(object sender, RoutedEventArgs e) - { - App.Instance.NavigateToSettingsPage(); - } - - /// - /// This is a common element that appears on every page. - /// - /// The view button. - public Button ViewButton - { - get - { - return TreeHelper.FindChild - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/AudioDefault.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/AudioDefault.png deleted file mode 100644 index 4c59084575..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/AudioDefault.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ChapterDefault.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ChapterDefault.png deleted file mode 100644 index 47b7375218..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ChapterDefault.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/CurrentUserDefault.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/CurrentUserDefault.png deleted file mode 100644 index 7a80db6e8d..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/CurrentUserDefault.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/DislikeOverlay.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/DislikeOverlay.png deleted file mode 100644 index da3af38217..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/DislikeOverlay.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/FavoriteOverlay.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/FavoriteOverlay.png deleted file mode 100644 index f948ea11f9..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/FavoriteOverlay.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/LikeOverlay.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/LikeOverlay.png deleted file mode 100644 index 93bff88f97..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/LikeOverlay.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/NowPlayingButton.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/NowPlayingButton.png deleted file mode 100644 index b0a4f26f95..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/NowPlayingButton.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/SearchButton.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/SearchButton.png deleted file mode 100644 index cb72919960..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/SearchButton.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/SettingsButton.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/SettingsButton.png deleted file mode 100644 index 37187dece3..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/SettingsButton.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/UserLoginDefault.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/UserLoginDefault.png deleted file mode 100644 index 14c83e7498..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/UserLoginDefault.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/VideoDefault.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/VideoDefault.png deleted file mode 100644 index 9c5e0a4ce1..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/VideoDefault.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewButton.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewButton.png deleted file mode 100644 index c0a8611bf2..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewButton.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Close.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Close.png deleted file mode 100644 index 5472b93aa3..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Close.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Decrease.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Decrease.png deleted file mode 100644 index 9b756c0a94..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Decrease.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Increase.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Increase.png deleted file mode 100644 index dadc5d0d2a..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Increase.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Index.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Index.png deleted file mode 100644 index 3e04dc6435..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Index.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Scroll.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Scroll.png deleted file mode 100644 index a52e85fbff..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Scroll.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Sort.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Sort.png deleted file mode 100644 index 45a9e58953..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/Sort.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/View.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/View.png deleted file mode 100644 index d83fb70a39..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/ViewMenu/View.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Watched.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Watched.png deleted file mode 100644 index f126059d79..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Watched.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Cloudy.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Cloudy.png deleted file mode 100644 index cef9cb5742..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Cloudy.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Overcast.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Overcast.png deleted file mode 100644 index 7ee2942e3d..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Overcast.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/PartlyCloudy.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/PartlyCloudy.png deleted file mode 100644 index d0e1cce56b..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/PartlyCloudy.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Rain.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Rain.png deleted file mode 100644 index c193633109..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Rain.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Snow.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Snow.png deleted file mode 100644 index 1867ee40f0..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Snow.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Sunny.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Sunny.png deleted file mode 100644 index be36d84460..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Sunny.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Thunder.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Thunder.png deleted file mode 100644 index 1269cfd775..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Thunder.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/starEmpty.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/starEmpty.png deleted file mode 100644 index b8355c7b16..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/starEmpty.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/starFull.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/starFull.png deleted file mode 100644 index d5df241024..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/starFull.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/starHalf.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/starHalf.png deleted file mode 100644 index e3251f0dd2..0000000000 Binary files a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/starHalf.png and /dev/null differ diff --git a/MediaBrowser.Plugins.DefaultTheme/Theme.cs b/MediaBrowser.Plugins.DefaultTheme/Theme.cs deleted file mode 100644 index 5a730cf081..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Theme.cs +++ /dev/null @@ -1,81 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Plugins.DefaultTheme.Pages; -using MediaBrowser.Plugins.DefaultTheme.Resources; -using MediaBrowser.UI; -using MediaBrowser.UI.Controller; -using System.Collections.Generic; -using System.Windows; -using System.Windows.Controls; - -namespace MediaBrowser.Plugins.DefaultTheme -{ - /// - /// Class Theme - /// - class Theme : BaseTheme - { - /// - /// Gets the detail page. - /// - /// The item. - /// Page. - public override Page GetDetailPage(BaseItemDto item) - { - return new DetailPage(item.Id); - } - - /// - /// Gets the list page. - /// - /// The item. - /// Page. - public override Page GetListPage(BaseItemDto item) - { - return new ListPage(item.Id); - } - - /// - /// Gets the home page. - /// - /// Page. - public override Page GetHomePage() - { - return new HomePage(); - } - - /// - /// Displays the weather. - /// - public override void DisplayWeather() - { - App.Instance.Navigate(new WeatherPage()); - } - - /// - /// Gets the login page. - /// - /// Page. - public override Page GetLoginPage() - { - return new LoginPage(); - } - - /// - /// Gets the internal player page. - /// - /// Page. - public override Page GetInternalPlayerPage() - { - return new InternalPlayerPage(); - } - - /// - /// Gets the global resources. - /// - /// IEnumerable{ResourceDictionary}. - public override IEnumerable GetGlobalResources() - { - return new[] { new AppResources() }; - } - } -} diff --git a/MediaBrowser.Plugins.DefaultTheme/app.config b/MediaBrowser.Plugins.DefaultTheme/app.config deleted file mode 100644 index 29abde1f69..0000000000 --- a/MediaBrowser.Plugins.DefaultTheme/app.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.UI.Controls/BaseModalWindow.cs b/MediaBrowser.UI.Controls/BaseModalWindow.cs deleted file mode 100644 index 90bd8114f6..0000000000 --- a/MediaBrowser.UI.Controls/BaseModalWindow.cs +++ /dev/null @@ -1,62 +0,0 @@ -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(); - } - } -} diff --git a/MediaBrowser.UI.Controls/BaseUserControl.cs b/MediaBrowser.UI.Controls/BaseUserControl.cs deleted file mode 100644 index e47fc84cf2..0000000000 --- a/MediaBrowser.UI.Controls/BaseUserControl.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.ComponentModel; -using System.Windows.Controls; - -namespace MediaBrowser.UI.Controls -{ - /// - /// Provides a base class for all user controls - /// - public abstract class BaseUserControl : UserControl - { - public event PropertyChangedEventHandler PropertyChanged; - - public virtual void OnPropertyChanged(string name) - { - if (PropertyChanged != null) - { - PropertyChanged(this, new PropertyChangedEventArgs(name)); - } - } - } -} 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; - } - } -} diff --git a/MediaBrowser.UI.Controls/ExtendedButton.cs b/MediaBrowser.UI.Controls/ExtendedButton.cs deleted file mode 100644 index 1b8e9039d4..0000000000 --- a/MediaBrowser.UI.Controls/ExtendedButton.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; - -namespace MediaBrowser.UI.Controls -{ - /// - /// This subclass simply autofocuses itself when the mouse moves over it - /// - public class ExtendedButton : Button - { - private Point? _lastMouseMovePoint; - - /// - /// Handles OnMouseMove to auto-select the item that's being moused over - /// - protected override void OnMouseMove(MouseEventArgs e) - { - base.OnMouseMove(e); - - var window = this.GetWindow(); - - // If the cursor is currently hidden, don't bother reacting to it - if (Cursor == Cursors.None || window.Cursor == Cursors.None) - { - return; - } - - // Store the last position for comparison purposes - // Even if the mouse is not moving this event will fire as elements are showing and hiding - var pos = e.GetPosition(window); - - if (!_lastMouseMovePoint.HasValue) - { - _lastMouseMovePoint = pos; - return; - } - - if (pos == _lastMouseMovePoint) - { - return; - } - - _lastMouseMovePoint = pos; - - Focus(); - } - } -} diff --git a/MediaBrowser.UI.Controls/ExtendedCheckbox.cs b/MediaBrowser.UI.Controls/ExtendedCheckbox.cs deleted file mode 100644 index 120fa3c24d..0000000000 --- a/MediaBrowser.UI.Controls/ExtendedCheckbox.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; - -namespace MediaBrowser.UI.Controls -{ - /// - /// Extends Checkbox to provide focus on mouse over - /// - public class ExtendedCheckbox : CheckBox - { - private Point? _lastMouseMovePoint; - - /// - /// Handles OnMouseMove to auto-select the item that's being moused over - /// - protected override void OnMouseMove(MouseEventArgs e) - { - base.OnMouseMove(e); - - var window = this.GetWindow(); - - // If the cursor is currently hidden, don't bother reacting to it - if (Cursor == Cursors.None || window.Cursor == Cursors.None) - { - return; - } - - // Store the last position for comparison purposes - // Even if the mouse is not moving this event will fire as elements are showing and hiding - var pos = e.GetPosition(window); - - if (!_lastMouseMovePoint.HasValue) - { - _lastMouseMovePoint = pos; - return; - } - - if (pos == _lastMouseMovePoint) - { - return; - } - - _lastMouseMovePoint = pos; - - Focus(); - } - } -} diff --git a/MediaBrowser.UI.Controls/ExtendedListBox.cs b/MediaBrowser.UI.Controls/ExtendedListBox.cs deleted file mode 100644 index fb6738939e..0000000000 --- a/MediaBrowser.UI.Controls/ExtendedListBox.cs +++ /dev/null @@ -1,260 +0,0 @@ -using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Input; -using System.Windows.Media; - -namespace MediaBrowser.UI.Controls -{ - /// - /// Extends the ListBox to provide auto-focus behavior when items are moused over - /// This also adds an ItemInvoked event that is fired when an item is clicked or invoked using the enter key - /// - public class ExtendedListBox : ListBox - { - /// - /// Fired when an item is clicked or invoked using the enter key - /// - public event EventHandler> ItemInvoked; - - /// - /// Called when [item invoked]. - /// - /// The bound object. - protected virtual void OnItemInvoked(object boundObject) - { - if (ItemInvoked != null) - { - ItemInvoked(this, new ItemEventArgs { Argument = boundObject }); - } - } - - /// - /// The _auto focus - /// - private bool _autoFocus = true; - /// - /// Gets or sets a value indicating if the first list item should be auto-focused on load - /// - /// true if [auto focus]; otherwise, false. - public bool AutoFocus - { - get { return _autoFocus; } - set - { - _autoFocus = value; - } - } - - /// - /// Initializes a new instance of the class. - /// - public ExtendedListBox() - : base() - { - ItemContainerGenerator.StatusChanged += ItemContainerGeneratorStatusChanged; - } - - /// - /// The mouse down object - /// - private object mouseDownObject; - - /// - /// Invoked when an unhandled attached routed 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. The event data reports that one or more mouse buttons were pressed. - protected override void OnPreviewMouseDown(MouseButtonEventArgs e) - { - base.OnPreviewMouseDown(e); - - // Get the item that the mouse down event occurred on - mouseDownObject = GetBoundListItemObject((DependencyObject)e.OriginalSource); - } - - /// - /// Invoked when an unhandled  routed 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. The event data reports that the left mouse button was released. - protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) - { - base.OnMouseLeftButtonUp(e); - - // If the mouse up event occurred on the same item as the mousedown event, then fire ItemInvoked - if (mouseDownObject != null) - { - var boundObject = GetBoundListItemObject((DependencyObject)e.OriginalSource); - - if (mouseDownObject == boundObject) - { - mouseDownObject = null; - OnItemInvoked(boundObject); - } - } - } - - /// - /// The key down object - /// - private object keyDownObject; - - /// - /// Responds to the event. - /// - /// Provides data for . - protected override void OnKeyDown(KeyEventArgs e) - { - if (e.Key == Key.Enter) - { - if (!e.IsRepeat) - { - // Get the item that the keydown event occurred on - keyDownObject = GetBoundListItemObject((DependencyObject)e.OriginalSource); - } - - e.Handled = true; - } - - base.OnKeyDown(e); - } - - /// - /// 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 OnKeyUp(KeyEventArgs e) - { - base.OnKeyUp(e); - - // Fire ItemInvoked when enter is pressed on an item - if (e.Key == Key.Enter) - { - if (!e.IsRepeat) - { - // If the keyup event occurred on the same item as the keydown event, then fire ItemInvoked - if (keyDownObject != null) - { - var boundObject = GetBoundListItemObject((DependencyObject)e.OriginalSource); - - if (keyDownObject == boundObject) - { - keyDownObject = null; - OnItemInvoked(boundObject); - } - } - } - - e.Handled = true; - } - } - - /// - /// The _last mouse move point - /// - private Point? _lastMouseMovePoint; - - /// - /// Handles OnMouseMove to auto-select the item that's being moused over - /// - /// Provides data for . - protected override void OnMouseMove(MouseEventArgs e) - { - base.OnMouseMove(e); - - var window = this.GetWindow(); - - // If the cursor is currently hidden, don't bother reacting to it - if (Cursor == Cursors.None || window.Cursor == Cursors.None) - { - return; - } - - // Store the last position for comparison purposes - // Even if the mouse is not moving this event will fire as elements are showing and hiding - var pos = e.GetPosition(window); - - if (!_lastMouseMovePoint.HasValue) - { - _lastMouseMovePoint = pos; - return; - } - - if (pos == _lastMouseMovePoint) - { - return; - } - - _lastMouseMovePoint = pos; - - var dep = (DependencyObject)e.OriginalSource; - - while ((dep != null) && !(dep is ListBoxItem)) - { - dep = VisualTreeHelper.GetParent(dep); - } - - if (dep != null) - { - var listBoxItem = dep as ListBoxItem; - - if (!listBoxItem.IsFocused) - { - listBoxItem.Focus(); - } - } - } - - /// - /// Gets the datacontext for a given ListBoxItem - /// - /// The dep. - /// System.Object. - private object GetBoundListItemObject(DependencyObject dep) - { - while ((dep != null) && !(dep is ListBoxItem)) - { - dep = VisualTreeHelper.GetParent(dep); - } - - if (dep == null) - { - return null; - } - - return ItemContainerGenerator.ItemFromContainer(dep); - } - - /// - /// Autofocuses the first list item when the list is loaded - /// - /// The sender. - /// The instance containing the event data. - void ItemContainerGeneratorStatusChanged(object sender, EventArgs e) - { - if (ItemContainerGenerator.Status == GeneratorStatus.ContainersGenerated && AutoFocus) - { - Dispatcher.InvokeAsync(OnContainersGenerated); - } - } - - /// - /// Called when [containers generated]. - /// - void OnContainersGenerated() - { - var index = 0; - - if (index >= 0) - { - var item = ItemContainerGenerator.ContainerFromIndex(index) as ListBoxItem; - - if (item != null) - { - item.Focus(); - ItemContainerGenerator.StatusChanged -= ItemContainerGeneratorStatusChanged; - } - } - } - } -} diff --git a/MediaBrowser.UI.Controls/ExtendedRadioButton.cs b/MediaBrowser.UI.Controls/ExtendedRadioButton.cs deleted file mode 100644 index 82aad7f098..0000000000 --- a/MediaBrowser.UI.Controls/ExtendedRadioButton.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; - -namespace MediaBrowser.UI.Controls -{ - /// - /// Extends RadioButton to provide focus on mouse over, and invoke on enter press - /// - public class ExtendedRadioButton : RadioButton - { - private Point? _lastMouseMovePoint; - - /// - /// Handles OnMouseMove to auto-select the item that's being moused over - /// - protected override void OnMouseMove(MouseEventArgs e) - { - base.OnMouseMove(e); - - var window = this.GetWindow(); - - // If the cursor is currently hidden, don't bother reacting to it - if (Cursor == Cursors.None || window.Cursor == Cursors.None) - { - return; - } - - // Store the last position for comparison purposes - // Even if the mouse is not moving this event will fire as elements are showing and hiding - var pos = e.GetPosition(window); - - if (!_lastMouseMovePoint.HasValue) - { - _lastMouseMovePoint = pos; - return; - } - - if (pos == _lastMouseMovePoint) - { - return; - } - - _lastMouseMovePoint = pos; - - Focus(); - } - } -} diff --git a/MediaBrowser.UI.Controls/ExtendedScrollViewer.cs b/MediaBrowser.UI.Controls/ExtendedScrollViewer.cs deleted file mode 100644 index c1a6f1c478..0000000000 --- a/MediaBrowser.UI.Controls/ExtendedScrollViewer.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Windows.Controls; -using System.Windows.Input; - -namespace MediaBrowser.UI.Controls -{ - /// - /// This subclass solves the problem of ScrollViewers eating KeyDown for all arrow keys - /// - public class ExtendedScrollViewer : ScrollViewer - { - protected override void OnKeyDown(KeyEventArgs e) - { - if (e.Handled || e.OriginalSource == this) - { - base.OnKeyDown(e); - return; - } - - // Don't eat left/right if horizontal scrolling is disabled - if (e.Key == Key.Left || e.Key == Key.Right) - { - if (HorizontalScrollBarVisibility == ScrollBarVisibility.Disabled) - { - return; - } - } - - // Don't eat up/down if vertical scrolling is disabled - if (e.Key == Key.Up || e.Key == Key.Down) - { - if (VerticalScrollBarVisibility == ScrollBarVisibility.Disabled) - { - return; - } - } - - // Let the base class do it's thing - base.OnKeyDown(e); - } - } -} diff --git a/MediaBrowser.UI.Controls/ItemEventArgs.cs b/MediaBrowser.UI.Controls/ItemEventArgs.cs deleted file mode 100644 index e0c24b2f59..0000000000 --- a/MediaBrowser.UI.Controls/ItemEventArgs.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace MediaBrowser.UI.Controls -{ - /// - /// Provides a generic EventArgs subclass that can hold any kind of object - /// - /// - public class ItemEventArgs : EventArgs - { - /// - /// Gets or sets the argument. - /// - /// The argument. - public T Argument { get; set; } - } -} diff --git a/MediaBrowser.UI.Controls/MediaBrowser.UI.Controls.csproj b/MediaBrowser.UI.Controls/MediaBrowser.UI.Controls.csproj deleted file mode 100644 index ee8d2dca76..0000000000 --- a/MediaBrowser.UI.Controls/MediaBrowser.UI.Controls.csproj +++ /dev/null @@ -1,110 +0,0 @@ - - - - - Debug - AnyCPU - {1ADFE460-FD95-46FA-8871-CCCB4B62E2E8} - library - Properties - MediaBrowser.UI.Controls - MediaBrowser.UI.Controls - v4.5 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\ThirdParty\Expression\Microsoft.Expression.Effects.dll - - - ..\ThirdParty\Expression\Microsoft.Expression.Interactions.dll - - - - - - - - - - 4.0 - - - - - - - - - - - - - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - MSBuild:Compile - Designer - - - - - xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i - - - \ No newline at end of file diff --git a/MediaBrowser.UI.Controls/Properties/AssemblyInfo.cs b/MediaBrowser.UI.Controls/Properties/AssemblyInfo.cs deleted file mode 100644 index 0d360004c1..0000000000 --- a/MediaBrowser.UI.Controls/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("MediaBrowser.UI.Controls")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("MediaBrowser.UI.Controls")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly:ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/MediaBrowser.UI.Controls/Properties/Resources.Designer.cs b/MediaBrowser.UI.Controls/Properties/Resources.Designer.cs deleted file mode 100644 index b03f1d59bd..0000000000 --- a/MediaBrowser.UI.Controls/Properties/Resources.Designer.cs +++ /dev/null @@ -1,62 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18033 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace MediaBrowser.UI.Controls.Properties { - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if ((resourceMan == null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediaBrowser.UI.Controls.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/MediaBrowser.UI.Controls/Properties/Resources.resx b/MediaBrowser.UI.Controls/Properties/Resources.resx deleted file mode 100644 index af7dbebbac..0000000000 --- a/MediaBrowser.UI.Controls/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/MediaBrowser.UI.Controls/Properties/Settings.Designer.cs b/MediaBrowser.UI.Controls/Properties/Settings.Designer.cs deleted file mode 100644 index d256289c13..0000000000 --- a/MediaBrowser.UI.Controls/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18033 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace MediaBrowser.UI.Controls.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/MediaBrowser.UI.Controls/Properties/Settings.settings b/MediaBrowser.UI.Controls/Properties/Settings.settings deleted file mode 100644 index 033d7a5e9e..0000000000 --- a/MediaBrowser.UI.Controls/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.UI.Controls/ScrollingPanel.cs b/MediaBrowser.UI.Controls/ScrollingPanel.cs deleted file mode 100644 index 636661f544..0000000000 --- a/MediaBrowser.UI.Controls/ScrollingPanel.cs +++ /dev/null @@ -1,404 +0,0 @@ -using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Media; -using System.Windows.Media.Animation; - -namespace MediaBrowser.UI.Controls -{ - /// - /// This started from: - /// http://www.switchonthecode.com/tutorials/wpf-tutorial-implementing-iscrollinfo - /// Then, after implementing this, content was being displayed in stack panel like manner. - /// I then reviewed the source code of ScrollContentPresenter and updated MeasureOverride and ArrangeOverride to match. - /// - public class ScrollingPanel : Grid, IScrollInfo - { - /// - /// The infinite size - /// - private static Size InfiniteSize = new Size(double.PositiveInfinity, double.PositiveInfinity); - /// - /// The line size - /// - private const double LineSize = 16; - /// - /// The wheel size - /// - private const double WheelSize = 3 * LineSize; - - /// - /// The _ offset - /// - private Vector _Offset; - /// - /// The _ extent - /// - private Size _Extent; - /// - /// The _ viewport - /// - private Size _Viewport; - - /// - /// The _ animation length - /// - private TimeSpan _AnimationLength = TimeSpan.FromMilliseconds(125); - - /// - /// When overridden in a derived class, measures the size in layout required for child elements and determines a size for the -derived class. - /// - /// The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available. - /// The size that this element determines it needs during layout, based on its calculations of child element sizes. - protected override Size MeasureOverride(Size availableSize) - { - if (Children == null || Children.Count == 0) - { - return availableSize; - } - - var constraint2 = availableSize; - if (CanHorizontallyScroll) - { - constraint2.Width = double.PositiveInfinity; - } - if (CanVerticallyScroll) - { - constraint2.Height = double.PositiveInfinity; - } - - var uiElement = Children[0]; - - uiElement.Measure(constraint2); - var size = uiElement.DesiredSize; - - VerifyScrollData(availableSize, size); - - size.Width = Math.Min(availableSize.Width, size.Width); - size.Height = Math.Min(availableSize.Height, size.Height); - - return size; - } - - /// - /// Arranges the content of a element. - /// - /// Specifies the size this element should use to arrange its child elements. - /// that represents the arranged size of this Grid element and its children. - protected override Size ArrangeOverride(Size arrangeSize) - { - this.VerifyScrollData(arrangeSize, _Extent); - - if (this.Children == null || this.Children.Count == 0) - { - return arrangeSize; - } - - TranslateTransform trans = null; - - var uiElement = Children[0]; - - var finalRect = new Rect(uiElement.DesiredSize); - - // ScrollContentPresenter sets these to 0 - current offset - // We need to set it to zero in order to make the animation work - finalRect.X = 0; - finalRect.Y = 0; - - finalRect.Width = Math.Max(finalRect.Width, arrangeSize.Width); - finalRect.Height = Math.Max(finalRect.Height, arrangeSize.Height); - - trans = uiElement.RenderTransform as TranslateTransform; - - if (trans == null) - { - uiElement.RenderTransformOrigin = new Point(0, 0); - trans = new TranslateTransform(); - uiElement.RenderTransform = trans; - } - - uiElement.Arrange(finalRect); - - trans.BeginAnimation(TranslateTransform.XProperty, - GetAnimation(0 - HorizontalOffset), - HandoffBehavior.Compose); - trans.BeginAnimation(TranslateTransform.YProperty, - GetAnimation(0 - VerticalOffset), - HandoffBehavior.Compose); - - return arrangeSize; - } - - /// - /// Gets the animation. - /// - /// To value. - /// DoubleAnimation. - private DoubleAnimation GetAnimation(double toValue) - { - var animation = new DoubleAnimation(toValue, _AnimationLength); - - animation.EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseInOut }; - - return animation; - } - - #region Movement Methods - /// - /// Scrolls down within content by one logical unit. - /// - public void LineDown() - { SetVerticalOffset(VerticalOffset + LineSize); } - - /// - /// Scrolls up within content by one logical unit. - /// - public void LineUp() - { SetVerticalOffset(VerticalOffset - LineSize); } - - /// - /// Scrolls left within content by one logical unit. - /// - public void LineLeft() - { SetHorizontalOffset(HorizontalOffset - LineSize); } - - /// - /// Scrolls right within content by one logical unit. - /// - public void LineRight() - { SetHorizontalOffset(HorizontalOffset + LineSize); } - - /// - /// Scrolls down within content after a user clicks the wheel button on a mouse. - /// - public void MouseWheelDown() - { SetVerticalOffset(VerticalOffset + WheelSize); } - - /// - /// Scrolls up within content after a user clicks the wheel button on a mouse. - /// - public void MouseWheelUp() - { SetVerticalOffset(VerticalOffset - WheelSize); } - - /// - /// Scrolls left within content after a user clicks the wheel button on a mouse. - /// - public void MouseWheelLeft() - { SetHorizontalOffset(HorizontalOffset - WheelSize); } - - /// - /// Scrolls right within content after a user clicks the wheel button on a mouse. - /// - public void MouseWheelRight() - { SetHorizontalOffset(HorizontalOffset + WheelSize); } - - /// - /// Scrolls down within content by one page. - /// - public void PageDown() - { SetVerticalOffset(VerticalOffset + ViewportHeight); } - - /// - /// Scrolls up within content by one page. - /// - public void PageUp() - { SetVerticalOffset(VerticalOffset - ViewportHeight); } - - /// - /// Scrolls left within content by one page. - /// - public void PageLeft() - { SetHorizontalOffset(HorizontalOffset - ViewportWidth); } - - /// - /// Scrolls right within content by one page. - /// - public void PageRight() - { SetHorizontalOffset(HorizontalOffset + ViewportWidth); } - #endregion - - /// - /// Gets or sets a element that controls scrolling behavior. - /// - /// The scroll owner. - /// A element that controls scrolling behavior. This property has no default value. - public ScrollViewer ScrollOwner { get; set; } - - /// - /// Gets or sets a value that indicates whether scrolling on the horizontal axis is possible. - /// - /// true if this instance can horizontally scroll; otherwise, false. - /// true if scrolling is possible; otherwise, false. This property has no default value. - public bool CanHorizontallyScroll { get; set; } - - /// - /// Gets or sets a value that indicates whether scrolling on the vertical axis is possible. - /// - /// true if this instance can vertically scroll; otherwise, false. - /// true if scrolling is possible; otherwise, false. This property has no default value. - public bool CanVerticallyScroll { get; set; } - - /// - /// Gets the vertical size of the extent. - /// - /// The height of the extent. - /// A that represents, in device independent pixels, the vertical size of the extent.This property has no default value. - public double ExtentHeight - { get { return _Extent.Height; } } - - /// - /// Gets the horizontal size of the extent. - /// - /// The width of the extent. - /// A that represents, in device independent pixels, the horizontal size of the extent. This property has no default value. - public double ExtentWidth - { get { return _Extent.Width; } } - - /// - /// Gets the horizontal offset of the scrolled content. - /// - /// The horizontal offset. - /// A that represents, in device independent pixels, the horizontal offset. This property has no default value. - public double HorizontalOffset - { get { return _Offset.X; } } - - /// - /// Gets the vertical offset of the scrolled content. - /// - /// The vertical offset. - /// A that represents, in device independent pixels, the vertical offset of the scrolled content. Valid values are between zero and the minus the . This property has no default value. - public double VerticalOffset - { get { return _Offset.Y; } } - - /// - /// Gets the vertical size of the viewport for this content. - /// - /// The height of the viewport. - /// A that represents, in device independent pixels, the vertical size of the viewport for this content. This property has no default value. - public double ViewportHeight - { get { return _Viewport.Height; } } - - /// - /// Gets the horizontal size of the viewport for this content. - /// - /// The width of the viewport. - /// A that represents, in device independent pixels, the horizontal size of the viewport for this content. This property has no default value. - public double ViewportWidth - { get { return _Viewport.Width; } } - - /// - /// Forces content to scroll until the coordinate space of a object is visible. - /// - /// A that becomes visible. - /// A bounding rectangle that identifies the coordinate space to make visible. - /// A that is visible. - public Rect MakeVisible(Visual visual, Rect rectangle) - { - if (rectangle.IsEmpty || visual == null - || visual == this || !base.IsAncestorOf(visual)) - { return Rect.Empty; } - - rectangle = visual.TransformToAncestor(this).TransformBounds(rectangle); - - //rectangle.Inflate(50, 50); - rectangle.Scale(1.2, 1.2); - - Rect viewRect = new Rect(HorizontalOffset, - VerticalOffset, ViewportWidth, ViewportHeight); - rectangle.X += viewRect.X; - rectangle.Y += viewRect.Y; - - viewRect.X = CalculateNewScrollOffset(viewRect.Left, - viewRect.Right, rectangle.Left, rectangle.Right); - viewRect.Y = CalculateNewScrollOffset(viewRect.Top, - viewRect.Bottom, rectangle.Top, rectangle.Bottom); - SetHorizontalOffset(viewRect.X); - SetVerticalOffset(viewRect.Y); - rectangle.Intersect(viewRect); - rectangle.X -= viewRect.X; - rectangle.Y -= viewRect.Y; - - return rectangle; - } - - /// - /// Calculates the new scroll offset. - /// - /// The top view. - /// The bottom view. - /// The top child. - /// The bottom child. - /// System.Double. - private static double CalculateNewScrollOffset(double topView, - double bottomView, double topChild, double bottomChild) - { - bool offBottom = topChild < topView && bottomChild < bottomView; - bool offTop = bottomChild > bottomView && topChild > topView; - bool tooLarge = (bottomChild - topChild) > (bottomView - topView); - - if (!offBottom && !offTop) - { return topView; } //Don't do anything, already in view - - if ((offBottom && !tooLarge) || (offTop && tooLarge)) - { return topChild; } - - return (bottomChild - (bottomView - topView)); - } - - /// - /// Verifies the scroll data. - /// - /// The viewport. - /// The extent. - protected void VerifyScrollData(Size viewport, Size extent) - { - if (double.IsInfinity(viewport.Width)) - { viewport.Width = extent.Width; } - - if (double.IsInfinity(viewport.Height)) - { viewport.Height = extent.Height; } - - _Extent = extent; - _Viewport = viewport; - - _Offset.X = Math.Max(0, - Math.Min(_Offset.X, ExtentWidth - ViewportWidth)); - _Offset.Y = Math.Max(0, - Math.Min(_Offset.Y, ExtentHeight - ViewportHeight)); - - if (ScrollOwner != null) - { ScrollOwner.InvalidateScrollInfo(); } - } - - /// - /// Sets the amount of horizontal offset. - /// - /// The degree to which content is horizontally offset from the containing viewport. - public void SetHorizontalOffset(double offset) - { - offset = Math.Max(0, - Math.Min(offset, ExtentWidth - ViewportWidth)); - if (!offset.Equals(_Offset.X)) - { - _Offset.X = offset; - InvalidateArrange(); - } - } - - /// - /// Sets the amount of vertical offset. - /// - /// The degree to which content is vertically offset from the containing viewport. - public void SetVerticalOffset(double offset) - { - offset = Math.Max(0, - Math.Min(offset, ExtentHeight - ViewportHeight)); - if (!offset.Equals(_Offset.Y)) - { - _Offset.Y = offset; - InvalidateArrange(); - } - } - } -} diff --git a/MediaBrowser.UI.Controls/Themes/Generic.xaml b/MediaBrowser.UI.Controls/Themes/Generic.xaml deleted file mode 100644 index 44e50a5596..0000000000 --- a/MediaBrowser.UI.Controls/Themes/Generic.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - diff --git a/MediaBrowser.UI.Controls/TransitionControl.cs b/MediaBrowser.UI.Controls/TransitionControl.cs deleted file mode 100644 index d1e5ccf0ae..0000000000 --- a/MediaBrowser.UI.Controls/TransitionControl.cs +++ /dev/null @@ -1,147 +0,0 @@ -using Microsoft.Expression.Media.Effects; -using System.ComponentModel; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; -using System.Windows.Media.Animation; - -namespace MediaBrowser.UI.Controls -{ - /// - /// http://victorcher.blogspot.com/2012/02/wpf-transactions.html - /// - public class TransitionControl : ContentControl - { - /// - /// The _content presenter - /// - private ContentPresenter _contentPresenter; - - /// - /// Initializes static members of the class. - /// - static TransitionControl() - { - DefaultStyleKeyProperty.OverrideMetadata( - typeof(TransitionControl), new FrameworkPropertyMetadata(typeof(TransitionControl))); - - ContentProperty.OverrideMetadata( - typeof(TransitionControl), new FrameworkPropertyMetadata(OnContentPropertyChanged)); - } - - /// - /// When overridden in a derived class, is invoked whenever application code or internal processes call . - /// - public override void OnApplyTemplate() - { - base.OnApplyTemplate(); - _contentPresenter = (ContentPresenter)Template.FindName("ContentPresenter", this); - } - - #region DP TransitionType - - /// - /// Gets or sets the type of the transition. - /// - /// The type of the transition. - public TransitionEffect TransitionType - { - get { return (TransitionEffect)GetValue(TransitionTypeProperty); } - set { SetValue(TransitionTypeProperty, value); } - } - - // Using a DependencyProperty as the backing store for TransitionType. This enables animation, styling, binding, etc... - /// - /// The transition type property - /// - public static readonly DependencyProperty TransitionTypeProperty = - DependencyProperty.Register("TransitionType", typeof(TransitionEffect), typeof(TransitionControl), - new UIPropertyMetadata(new BlindsTransitionEffect())); - - #endregion DP TransitionType - - #region DP Transition Animation - - /// - /// Gets or sets the transition animation. - /// - /// The transition animation. - public DoubleAnimation TransitionAnimation - { - get { return (DoubleAnimation)GetValue(TransitionAnimationProperty); } - set { SetValue(TransitionAnimationProperty, value); } - } - - // Using a DependencyProperty as the backing store for TransitionAnimation. This enables animation, styling, binding, etc... - /// - /// The transition animation property - /// - public static readonly DependencyProperty TransitionAnimationProperty = - DependencyProperty.Register("TransitionAnimation", typeof(DoubleAnimation), typeof(TransitionControl), new UIPropertyMetadata(null)); - - #endregion DP Transition Animation - - /// - /// Called when [content property changed]. - /// - /// The dp. - /// The instance containing the event data. - private static void OnContentPropertyChanged(DependencyObject dp, DependencyPropertyChangedEventArgs args) - { - var oldContent = args.OldValue; - var newContent = args.NewValue; - - var transitionControl = (TransitionControl)dp; - - if (DesignerProperties.GetIsInDesignMode(transitionControl)) - return; - - if (oldContent != null && newContent != null && transitionControl.IsVisible) - { - transitionControl.AnimateContent(oldContent, newContent); - } - else if (newContent != null) - { - transitionControl.Content = newContent; - } - } - - /// - /// Animates the content. - /// - /// The old content. - /// The new content. - private void AnimateContent(object oldContent, object newContent) - { - FrameworkElement oldContentVisual; - - try - { - oldContentVisual = VisualTreeHelper.GetChild(_contentPresenter, 0) as FrameworkElement; - } - catch - { - return; - } - - var transitionEffect = TransitionType; - - if (transitionEffect == null) - { - _contentPresenter.Content = newContent; - return; - } - - var da = TransitionAnimation; - da.From = 0; - da.To = 1; - da.FillBehavior = FillBehavior.HoldEnd; - - transitionEffect.OldImage = new VisualBrush(oldContentVisual); - transitionEffect.BeginAnimation(TransitionEffect.ProgressProperty, da); - - _contentPresenter.Effect = transitionEffect; - _contentPresenter.Content = newContent; - } - } -} \ No newline at end of file diff --git a/MediaBrowser.UI.Controls/TransitionFrame.cs b/MediaBrowser.UI.Controls/TransitionFrame.cs deleted file mode 100644 index e6f8325cc8..0000000000 --- a/MediaBrowser.UI.Controls/TransitionFrame.cs +++ /dev/null @@ -1,194 +0,0 @@ -using Microsoft.Expression.Media.Effects; -using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; -using System.Windows.Media.Animation; - -namespace MediaBrowser.UI.Controls -{ - /// - /// Class TransitionFrame - /// - public class TransitionFrame : Frame - { - /// - /// The _content presenter - /// - private ContentPresenter _contentPresenter = null; - - #region DP TransitionType - - /// - /// Gets or sets the type of the transition. - /// - /// The type of the transition. - public TransitionEffect TransitionType - { - get { return (TransitionEffect)GetValue(TransitionTypeProperty); } - set { SetValue(TransitionTypeProperty, value); } - } - - // Using a DependencyProperty as the backing store for TransitionType. This enables animation, styling, binding, etc... - /// - /// The transition type property - /// - public static readonly DependencyProperty TransitionTypeProperty = - DependencyProperty.Register("TransitionType", typeof(TransitionEffect), typeof(TransitionFrame), - new UIPropertyMetadata(new BlindsTransitionEffect())); - - #endregion DP TransitionType - - #region DP Transition Animation - - /// - /// Gets or sets the transition animation. - /// - /// The transition animation. - public DoubleAnimation TransitionAnimation - { - get { return (DoubleAnimation)GetValue(TransitionAnimationProperty); } - set { SetValue(TransitionAnimationProperty, value); } - } - - // Using a DependencyProperty as the backing store for TransitionAnimation. This enables animation, styling, binding, etc... - /// - /// The transition animation property - /// - public static readonly DependencyProperty TransitionAnimationProperty = - DependencyProperty.Register("TransitionAnimation", typeof(DoubleAnimation), typeof(TransitionFrame), new UIPropertyMetadata(null)); - - #endregion DP Transition Animation - - /// - /// Called when the template generation for the visual tree is created. - /// - public override void OnApplyTemplate() - { - // get a reference to the frame's content presenter - // this is the element we will fade in and out - _contentPresenter = GetTemplateChild("PART_FrameCP") as ContentPresenter; - base.OnApplyTemplate(); - } - - /// - /// Animates the content. - /// - /// The navigation action. - /// if set to true [check content]. - /// if set to true [is back]. - private void AnimateContent(Action navigationAction, bool checkContent = true, bool isBack = false) - { - if (TransitionType == null || (checkContent && Content == null)) - { - CommandBindings.Clear(); - navigationAction(); - CommandBindings.Clear(); - return; - } - - var oldContentVisual = this as FrameworkElement; - - _contentPresenter.IsHitTestVisible = false; - - var da = TransitionAnimation.Clone(); - da.From = 0; - da.To = 1; - da.FillBehavior = FillBehavior.HoldEnd; - - var transitionEffect = TransitionType.Clone() as TransitionEffect; - - if (isBack) - { - ReverseDirection(transitionEffect); - } - - transitionEffect.OldImage = new VisualBrush(oldContentVisual); - transitionEffect.BeginAnimation(TransitionEffect.ProgressProperty, da); - - _contentPresenter.Effect = transitionEffect; - _contentPresenter.IsHitTestVisible = true; - - // Remove base class bindings to remote buttons - CommandBindings.Clear(); - - navigationAction(); - - CommandBindings.Clear(); - } - - /// - /// Navigates the with transition. - /// - /// The page. - public void NavigateWithTransition(Page page) - { - AnimateContent(() => Navigate(page)); - } - - /// - /// Navigates the with transition. - /// - /// The page. - public void NavigateWithTransition(Uri page) - { - AnimateContent(() => Navigate(page)); - } - - /// - /// Goes the back with transition. - /// - public void GoBackWithTransition() - { - if (CanGoBack) - { - AnimateContent(GoBack, false, true); - } - } - - /// - /// Goes the forward with transition. - /// - public void GoForwardWithTransition() - { - if (CanGoForward) - { - AnimateContent(GoForward, false); - } - } - - /// - /// Reverses the direction. - /// - /// The transition effect. - private void ReverseDirection(TransitionEffect transitionEffect) - { - var circleRevealTransitionEffect = transitionEffect as CircleRevealTransitionEffect; - - if (circleRevealTransitionEffect != null) - { - circleRevealTransitionEffect.Reverse = true; - return; - } - - var slideInTransitionEffect = transitionEffect as SlideInTransitionEffect; - if (slideInTransitionEffect != null) - { - if (slideInTransitionEffect.SlideDirection == SlideDirection.RightToLeft) - { - slideInTransitionEffect.SlideDirection = SlideDirection.LeftToRight; - } - return; - } - - var wipeTransitionEffect = transitionEffect as WipeTransitionEffect; - if (wipeTransitionEffect != null) - { - if (wipeTransitionEffect.WipeDirection == WipeDirection.RightToLeft) - { - wipeTransitionEffect.WipeDirection = WipeDirection.LeftToRight; - } - } - } - } -} diff --git a/MediaBrowser.UI.Controls/TreeHelper.cs b/MediaBrowser.UI.Controls/TreeHelper.cs deleted file mode 100644 index 0347f1eba4..0000000000 --- a/MediaBrowser.UI.Controls/TreeHelper.cs +++ /dev/null @@ -1,321 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Windows; -using System.Windows.Media; - -namespace MediaBrowser.UI.Controls -{ - /// - /// Helper methods for UI-related tasks. - /// - public static class TreeHelper - { - /// - /// Gets the window. - /// - /// The element. - /// Window. - /// The window. - public static Window GetWindow(this FrameworkElement element) - { - return element.ParentOfType(); - } - - /// - /// Gets the parent. - /// - /// The element. - /// DependencyObject. - private static DependencyObject GetParent(this DependencyObject element) - { - DependencyObject parent = VisualTreeHelper.GetParent(element); - if (parent == null) - { - FrameworkElement frameworkElement = element as FrameworkElement; - if (frameworkElement != null) - { - parent = frameworkElement.Parent; - } - } - return parent; - } - - /// - /// Gets the parents. - /// - /// The element. - /// IEnumerable{DependencyObject}. - /// element - public static IEnumerable GetParents(this DependencyObject element) - { - if (element == null) - { - throw new ArgumentNullException("element"); - } - while ((element = element.GetParent()) != null) - { - yield return element; - } - yield break; - } - - /// - /// Parents the type of the of. - /// - /// - /// The element. - /// ``0. - public static T ParentOfType(this DependencyObject element) where T : DependencyObject - { - if (element == null) - { - return default(T); - } - return element.GetParents().OfType().FirstOrDefault(); - } - - /// - /// Finds a Child of a given item in the visual tree. - /// - /// The type of the queried item. - /// A direct parent of the queried item. - /// x:Name or Name of child. - /// The first parent item that matches the submitted type parameter. - /// If not matching item can be found, - /// a null parent is being returned. - public static T FindChild(DependencyObject parent, string childName) - where T : DependencyObject - { - // Confirm parent and childName are valid. - if (parent == null) return null; - - T foundChild = null; - - int childrenCount = VisualTreeHelper.GetChildrenCount(parent); - for (int i = 0; i < childrenCount; i++) - { - var child = VisualTreeHelper.GetChild(parent, i); - // If the child is not of the request child type child - T childType = child as T; - if (childType == null) - { - // recursively drill down the tree - foundChild = FindChild(child, childName); - - // If the child is found, break so we do not overwrite the found child. - if (foundChild != null) break; - } - else if (!string.IsNullOrEmpty(childName)) - { - var frameworkElement = child as FrameworkElement; - // If the child's name is set for search - if (frameworkElement != null && frameworkElement.Name == childName) - { - // if the child's name is of the request name - foundChild = (T)child; - break; - } - } - else - { - // child element found. - foundChild = (T)child; - break; - } - } - - return foundChild; - } - - /// - /// Gets the visual child. - /// - /// - /// The reference visual. - /// ``0. - public static T GetVisualChild(this Visual referenceVisual) where T : Visual - { - Visual child = null; - for (Int32 i = 0; i < VisualTreeHelper.GetChildrenCount(referenceVisual); i++) - { - child = VisualTreeHelper.GetChild(referenceVisual, i) as Visual; - if (child != null && (child.GetType() == typeof(T))) - { - break; - } - else if (child != null) - { - child = GetVisualChild(child); - if (child != null && (child.GetType() == typeof(T))) - { - break; - } - } - } - return child as T; - } - - #region find parent - - /// - /// Finds a parent of a given item on the visual tree. - /// - /// The type of the queried item. - /// A direct or indirect child of the - /// queried item. - /// The first parent item that matches the submitted - /// type parameter. If not matching item can be found, a null - /// reference is being returned. - public static T TryFindParent(this DependencyObject child) - where T : DependencyObject - { - //get parent item - DependencyObject parentObject = GetParentObject(child); - - //we've reached the end of the tree - if (parentObject == null) return null; - - //check if the parent matches the type we're looking for - T parent = parentObject as T; - if (parent != null) - { - return parent; - } - - //use recursion to proceed with next level - return TryFindParent(parentObject); - } - - /// - /// This method is an alternative to WPF's - /// method, which also - /// supports content elements. Keep in mind that for content element, - /// this method falls back to the logical tree of the element! - /// - /// The item to be processed. - /// The submitted item's parent, if available. Otherwise - /// null. - public static DependencyObject GetParentObject(this DependencyObject child) - { - if (child == null) return null; - - //handle content elements separately - ContentElement contentElement = child as ContentElement; - if (contentElement != null) - { - DependencyObject parent = ContentOperations.GetParent(contentElement); - if (parent != null) return parent; - - FrameworkContentElement fce = contentElement as FrameworkContentElement; - return fce != null ? fce.Parent : null; - } - - //also try searching for parent in framework elements (such as DockPanel, etc) - FrameworkElement frameworkElement = child as FrameworkElement; - if (frameworkElement != null) - { - DependencyObject parent = frameworkElement.Parent; - if (parent != null) return parent; - } - - //if it's not a ContentElement/FrameworkElement, rely on VisualTreeHelper - return VisualTreeHelper.GetParent(child); - } - - #endregion - - #region find children - - /// - /// Analyzes both visual and logical tree in order to find all elements of a given - /// type that are descendants of the item. - /// - /// The type of the queried items. - /// The root element that marks the source of the search. If the - /// source is already of the requested type, it will not be included in the result. - /// All descendants of that match the requested type. - public static IEnumerable FindChildren(this DependencyObject source) where T : DependencyObject - { - if (source != null) - { - var childs = GetChildObjects(source); - foreach (DependencyObject child in childs) - { - //analyze if children match the requested type - if (child is T) - { - yield return (T)child; - } - - //recurse tree - foreach (T descendant in FindChildren(child)) - { - yield return descendant; - } - } - } - } - - - /// - /// This method is an alternative to WPF's - /// method, which also - /// supports content elements. Keep in mind that for content elements, - /// this method falls back to the logical tree of the element. - /// - /// The item to be processed. - /// The submitted item's child elements, if available. - public static IEnumerable GetChildObjects(this DependencyObject parent) - { - if (parent == null) yield break; - - if (parent is ContentElement || parent is FrameworkElement) - { - //use the logical tree for content / framework elements - foreach (object obj in LogicalTreeHelper.GetChildren(parent)) - { - var depObj = obj as DependencyObject; - if (depObj != null) yield return (DependencyObject)obj; - } - } - else - { - //use the visual tree per default - int count = VisualTreeHelper.GetChildrenCount(parent); - for (int i = 0; i < count; i++) - { - yield return VisualTreeHelper.GetChild(parent, i); - } - } - } - - #endregion - - #region find from point - - /// - /// Tries to locate a given item within the visual tree, - /// starting with the dependency object at a given position. - /// - /// The type of the element to be found - /// on the visual tree of the element at the given location. - /// The main element which is used to perform - /// hit testing. - /// The position to be evaluated on the origin. - /// ``0. - public static T TryFindFromPoint(UIElement reference, Point point) - where T : DependencyObject - { - DependencyObject element = reference.InputHitTest(point) as DependencyObject; - - if (element == null) return null; - - if (element is T) return (T)element; - - return TryFindParent(element); - } - - #endregion - } -} diff --git a/MediaBrowser.UI.Controls/VirtualizingWrapPanel.cs b/MediaBrowser.UI.Controls/VirtualizingWrapPanel.cs deleted file mode 100644 index e9753ccea8..0000000000 --- a/MediaBrowser.UI.Controls/VirtualizingWrapPanel.cs +++ /dev/null @@ -1,735 +0,0 @@ -using System; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Media; - -namespace MediaBrowser.UI.Controls -{ - /// - /// http://www.codeproject.com/Articles/75847/Virtualizing-WrapPanel - /// Positions child elements in sequential position from left to right, breaking content - /// to the next line at the edge of the containing box. Subsequent ordering happens - /// sequentially from top to bottom or from right to left, depending on the value of - /// the Orientation property. - /// - [DefaultProperty("Orientation")] - public class VirtualizingWrapPanel : VirtualizingPanel, IScrollInfo - { - /// - /// Identifies the ItemHeight dependency property. - /// - public static readonly DependencyProperty ItemHeightProperty = DependencyProperty.Register("ItemHeight", typeof(double), typeof(VirtualizingWrapPanel), new PropertyMetadata(100.0, new PropertyChangedCallback(VirtualizingWrapPanel.OnAppearancePropertyChanged))); - /// - /// Identifies the Orientation dependency property. - /// - public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(Orientation), typeof(VirtualizingWrapPanel), new PropertyMetadata(Orientation.Horizontal, new PropertyChangedCallback(VirtualizingWrapPanel.OnAppearancePropertyChanged))); - /// - /// Identifies the ItemWidth dependency property. - /// - public static readonly DependencyProperty ItemWidthProperty = DependencyProperty.Register("ItemWidth", typeof(double), typeof(VirtualizingWrapPanel), new PropertyMetadata(100.0, new PropertyChangedCallback(VirtualizingWrapPanel.OnAppearancePropertyChanged))); - /// - /// Identifies the ScrollStep dependency property. - /// - public static readonly DependencyProperty ScrollStepProperty = DependencyProperty.Register("ScrollStep", typeof(double), typeof(VirtualizingWrapPanel), new PropertyMetadata(10.0, new PropertyChangedCallback(VirtualizingWrapPanel.OnAppearancePropertyChanged))); - private bool canHorizontallyScroll; - private bool canVerticallyScroll; - private Size contentExtent = new Size(0.0, 0.0); - private Point contentOffset = default(Point); - private ScrollViewer scrollOwner; - private Size viewport = new Size(0.0, 0.0); - private int previousItemCount; - /// - /// Gets or sets a value that specifies the height of all items that are - /// contained within a VirtualizingWrapPanel. This is a dependency property. - /// - public double ItemHeight - { - get - { - return (double)base.GetValue(VirtualizingWrapPanel.ItemHeightProperty); - } - set - { - base.SetValue(VirtualizingWrapPanel.ItemHeightProperty, value); - } - } - /// - /// Gets or sets a value that specifies the width of all items that are - /// contained within a VirtualizingWrapPanel. This is a dependency property. - /// - public double ItemWidth - { - get - { - return (double)base.GetValue(VirtualizingWrapPanel.ItemWidthProperty); - } - set - { - base.SetValue(VirtualizingWrapPanel.ItemWidthProperty, value); - } - } - /// - /// Gets or sets a value that specifies the dimension in which child - /// content is arranged. This is a dependency property. - /// - public Orientation Orientation - { - get - { - return (Orientation)base.GetValue(VirtualizingWrapPanel.OrientationProperty); - } - set - { - base.SetValue(VirtualizingWrapPanel.OrientationProperty, value); - } - } - /// - /// Gets or sets a value that indicates whether scrolling on the horizontal axis is possible. - /// - public bool CanHorizontallyScroll - { - get - { - return this.canHorizontallyScroll; - } - set - { - if (this.canHorizontallyScroll != value) - { - this.canHorizontallyScroll = value; - base.InvalidateMeasure(); - } - } - } - /// - /// Gets or sets a value that indicates whether scrolling on the vertical axis is possible. - /// - public bool CanVerticallyScroll - { - get - { - return this.canVerticallyScroll; - } - set - { - if (this.canVerticallyScroll != value) - { - this.canVerticallyScroll = value; - base.InvalidateMeasure(); - } - } - } - /// - /// Gets or sets a ScrollViewer element that controls scrolling behavior. - /// - public ScrollViewer ScrollOwner - { - get - { - return this.scrollOwner; - } - set - { - this.scrollOwner = value; - } - } - /// - /// Gets the vertical offset of the scrolled content. - /// - public double VerticalOffset - { - get - { - return this.contentOffset.Y; - } - } - /// - /// Gets the vertical size of the viewport for this content. - /// - public double ViewportHeight - { - get - { - return this.viewport.Height; - } - } - /// - /// Gets the horizontal size of the viewport for this content. - /// - public double ViewportWidth - { - get - { - return this.viewport.Width; - } - } - /// - /// Gets or sets a value for mouse wheel scroll step. - /// - public double ScrollStep - { - get - { - return (double)base.GetValue(VirtualizingWrapPanel.ScrollStepProperty); - } - set - { - base.SetValue(VirtualizingWrapPanel.ScrollStepProperty, value); - } - } - /// - /// Gets the vertical size of the extent. - /// - public double ExtentHeight - { - get - { - return this.contentExtent.Height; - } - } - /// - /// Gets the horizontal size of the extent. - /// - public double ExtentWidth - { - get - { - return this.contentExtent.Width; - } - } - /// - /// Gets the horizontal offset of the scrolled content. - /// - public double HorizontalOffset - { - get - { - return this.contentOffset.X; - } - } - /// - /// Scrolls down within content by one logical unit. - /// - public void LineDown() - { - this.SetVerticalOffset(this.VerticalOffset + this.ScrollStep); - } - /// - /// Scrolls left within content by one logical unit. - /// - public void LineLeft() - { - this.SetHorizontalOffset(this.HorizontalOffset - this.ScrollStep); - } - /// - /// Scrolls right within content by one logical unit. - /// - public void LineRight() - { - this.SetHorizontalOffset(this.HorizontalOffset + this.ScrollStep); - } - /// - /// Scrolls up within content by one logical unit. - /// - public void LineUp() - { - this.SetVerticalOffset(this.VerticalOffset - this.ScrollStep); - } - /// - /// Forces content to scroll until the coordinate space of a Visual object is visible. - /// - public Rect MakeVisible(Visual visual, Rect rectangle) - { - this.MakeVisible(visual as UIElement); - return rectangle; - } - /// - /// Scrolls down within content after a user clicks the wheel button on a mouse. - /// - public void MouseWheelDown() - { - this.SetVerticalOffset(this.VerticalOffset + this.ScrollStep); - } - /// - /// Scrolls left within content after a user clicks the wheel button on a mouse. - /// - public void MouseWheelLeft() - { - this.SetHorizontalOffset(this.HorizontalOffset - this.ScrollStep); - } - /// - /// Scrolls right within content after a user clicks the wheel button on a mouse. - /// - public void MouseWheelRight() - { - this.SetHorizontalOffset(this.HorizontalOffset + this.ScrollStep); - } - /// - /// Scrolls up within content after a user clicks the wheel button on a mouse. - /// - public void MouseWheelUp() - { - this.SetVerticalOffset(this.VerticalOffset - this.ScrollStep); - } - /// - /// Scrolls down within content by one page. - /// - public void PageDown() - { - this.SetVerticalOffset(this.VerticalOffset + this.ViewportHeight); - } - /// - /// Scrolls left within content by one page. - /// - public void PageLeft() - { - this.SetHorizontalOffset(this.HorizontalOffset - this.ViewportHeight); - } - /// - /// Scrolls right within content by one page. - /// - public void PageRight() - { - this.SetHorizontalOffset(this.HorizontalOffset + this.ViewportHeight); - } - /// - /// Scrolls up within content by one page. - /// - public void PageUp() - { - this.SetVerticalOffset(this.VerticalOffset - this.viewport.Height); - } - /// - /// Sets the amount of vertical offset. - /// - public void SetVerticalOffset(double offset) - { - if (offset < 0.0 || this.ViewportHeight >= this.ExtentHeight) - { - offset = 0.0; - } - else - { - if (offset + this.ViewportHeight >= this.ExtentHeight) - { - offset = this.ExtentHeight - this.ViewportHeight; - } - } - this.contentOffset.Y = offset; - if (this.ScrollOwner != null) - { - this.ScrollOwner.InvalidateScrollInfo(); - } - base.InvalidateMeasure(); - } - /// - /// Sets the amount of horizontal offset. - /// - public void SetHorizontalOffset(double offset) - { - if (offset < 0.0 || this.ViewportWidth >= this.ExtentWidth) - { - offset = 0.0; - } - else - { - if (offset + this.ViewportWidth >= this.ExtentWidth) - { - offset = this.ExtentWidth - this.ViewportWidth; - } - } - this.contentOffset.X = offset; - if (this.ScrollOwner != null) - { - this.ScrollOwner.InvalidateScrollInfo(); - } - base.InvalidateMeasure(); - } - /// - /// Note: Works only for vertical. - /// - internal void PageLast() - { - this.contentOffset.Y = this.ExtentHeight; - if (this.ScrollOwner != null) - { - this.ScrollOwner.InvalidateScrollInfo(); - } - base.InvalidateMeasure(); - } - /// - /// Note: Works only for vertical. - /// - internal void PageFirst() - { - this.contentOffset.Y = 0.0; - if (this.ScrollOwner != null) - { - this.ScrollOwner.InvalidateScrollInfo(); - } - base.InvalidateMeasure(); - } - /// - /// When items are removed, remove the corresponding UI if necessary. - /// - /// - /// - protected override void OnItemsChanged(object sender, ItemsChangedEventArgs args) - { - switch (args.Action) - { - case NotifyCollectionChangedAction.Remove: - case NotifyCollectionChangedAction.Replace: - case NotifyCollectionChangedAction.Move: - base.RemoveInternalChildRange(args.Position.Index, args.ItemUICount); - return; - case NotifyCollectionChangedAction.Reset: - { - ItemsControl itemsControl = ItemsControl.GetItemsOwner(this); - if (itemsControl != null) - { - if (this.previousItemCount != itemsControl.Items.Count) - { - if (this.Orientation == Orientation.Horizontal) - { - this.SetVerticalOffset(0.0); - } - else - { - this.SetHorizontalOffset(0.0); - } - } - this.previousItemCount = itemsControl.Items.Count; - } - return; - } - default: - return; - } - } - /// - /// Measure the children. - /// - /// The available size. - /// The desired size. - protected override Size MeasureOverride(Size availableSize) - { - this.InvalidateScrollInfo(availableSize); - int firstVisibleIndex; - int lastVisibleIndex; - if (this.Orientation == Orientation.Horizontal) - { - this.GetVerticalVisibleRange(out firstVisibleIndex, out lastVisibleIndex); - } - else - { - this.GetHorizontalVisibleRange(out firstVisibleIndex, out lastVisibleIndex); - } - UIElementCollection children = base.Children; - IItemContainerGenerator generator = base.ItemContainerGenerator; - if (generator != null) - { - GeneratorPosition startPos = generator.GeneratorPositionFromIndex(firstVisibleIndex); - int childIndex = (startPos.Offset == 0) ? startPos.Index : (startPos.Index + 1); - if (childIndex == -1) - { - this.RefreshOffset(); - } - using (generator.StartAt(startPos, GeneratorDirection.Forward, true)) - { - int itemIndex = firstVisibleIndex; - while (itemIndex <= lastVisibleIndex) - { - bool newlyRealized; - UIElement child = generator.GenerateNext(out newlyRealized) as UIElement; - if (newlyRealized) - { - if (childIndex >= children.Count) - { - base.AddInternalChild(child); - } - else - { - base.InsertInternalChild(childIndex, child); - } - generator.PrepareItemContainer(child); - } - if (child != null) - { - child.Measure(new Size(this.ItemWidth, this.ItemHeight)); - } - itemIndex++; - childIndex++; - } - } - this.CleanUpChildren(firstVisibleIndex, lastVisibleIndex); - } - if (IsCloseTo(availableSize.Height, double.PositiveInfinity) || IsCloseTo(availableSize.Width, double.PositiveInfinity)) - { - return base.MeasureOverride(availableSize); - } - - var itemsControl = ItemsControl.GetItemsOwner(this); - var numItems = itemsControl.Items.Count; - - var width = availableSize.Width; - var height = availableSize.Height; - - if (Orientation == Orientation.Vertical) - { - var numRows = Math.Floor(availableSize.Height / ItemHeight); - - height = numRows * ItemHeight; - - var requiredColumns = Math.Ceiling(numItems / numRows); - - width = Math.Min(requiredColumns * ItemWidth, width); - } - else - { - var numColumns = Math.Floor(availableSize.Width / ItemWidth); - - width = numColumns * ItemWidth; - - //if (numItems > 0 && numItems < numColumns) - //{ - // width = Math.Min(numColumns, numItems) * ItemWidth; - //} - - var requiredRows = Math.Ceiling(numItems / numColumns); - - height = Math.Min(requiredRows * ItemHeight, height); - } - - return new Size(width, height); - } - - /// - /// Arranges the children. - /// - /// The available size. - /// The used size. - protected override Size ArrangeOverride(Size finalSize) - { - bool isHorizontal = this.Orientation == Orientation.Horizontal; - this.InvalidateScrollInfo(finalSize); - int i = 0; - foreach (object item in base.Children) - { - this.ArrangeChild(isHorizontal, finalSize, i++, item as UIElement); - } - return finalSize; - } - private static void OnAppearancePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - UIElement panel = d as UIElement; - if (panel != null) - { - panel.InvalidateMeasure(); - } - } - private void MakeVisible(UIElement element) - { - ItemContainerGenerator generator = base.ItemContainerGenerator.GetItemContainerGeneratorForPanel(this); - if (element != null && generator != null) - { - for (int itemIndex = generator.IndexFromContainer(element); itemIndex == -1; itemIndex = generator.IndexFromContainer(element)) - { - element = element.ParentOfType(); - } - ScrollViewer scrollViewer = element.ParentOfType(); - if (scrollViewer != null) - { - GeneralTransform elementTransform = element.TransformToVisual(scrollViewer); - Rect elementRectangle = elementTransform.TransformBounds(new Rect(new Point(0.0, 0.0), element.RenderSize)); - - if (this.Orientation == Orientation.Horizontal) - { - var padding = ItemHeight / 3; - - if (elementRectangle.Bottom > this.ViewportHeight) - { - this.SetVerticalOffset(this.contentOffset.Y + elementRectangle.Bottom - this.ViewportHeight + padding); - return; - } - if (elementRectangle.Top < 0.0) - { - this.SetVerticalOffset(this.contentOffset.Y + elementRectangle.Top - padding); - return; - } - } - else - { - var padding = ItemWidth / 3; - - if (elementRectangle.Right > this.ViewportWidth) - { - this.SetHorizontalOffset(this.contentOffset.X + elementRectangle.Right - this.ViewportWidth + padding); - return; - } - if (elementRectangle.Left < 0.0) - { - this.SetHorizontalOffset(this.contentOffset.X + elementRectangle.Left - padding); - } - } - } - } - } - private void GetVerticalVisibleRange(out int firstVisibleItemIndex, out int lastVisibleItemIndex) - { - int childrenPerRow = this.GetVerticalChildrenCountPerRow(this.contentExtent); - firstVisibleItemIndex = (int)Math.Floor(this.VerticalOffset / this.ItemHeight) * childrenPerRow; - lastVisibleItemIndex = (int)Math.Ceiling((this.VerticalOffset + this.ViewportHeight) / this.ItemHeight) * childrenPerRow - 1; - this.AdjustVisibleRange(ref firstVisibleItemIndex, ref lastVisibleItemIndex); - } - private void GetHorizontalVisibleRange(out int firstVisibleItemIndex, out int lastVisibleItemIndex) - { - int childrenPerRow = this.GetHorizontalChildrenCountPerRow(this.contentExtent); - firstVisibleItemIndex = (int)Math.Floor(this.HorizontalOffset / this.ItemWidth) * childrenPerRow; - lastVisibleItemIndex = (int)Math.Ceiling((this.HorizontalOffset + this.ViewportWidth) / this.ItemWidth) * childrenPerRow - 1; - this.AdjustVisibleRange(ref firstVisibleItemIndex, ref lastVisibleItemIndex); - } - private void AdjustVisibleRange(ref int firstVisibleItemIndex, ref int lastVisibleItemIndex) - { - firstVisibleItemIndex--; - lastVisibleItemIndex++; - ItemsControl itemsControl = ItemsControl.GetItemsOwner(this); - if (itemsControl != null) - { - if (firstVisibleItemIndex < 0) - { - firstVisibleItemIndex = 0; - } - if (lastVisibleItemIndex >= itemsControl.Items.Count) - { - lastVisibleItemIndex = itemsControl.Items.Count - 1; - } - } - } - private void CleanUpChildren(int minIndex, int maxIndex) - { - UIElementCollection children = base.Children; - IItemContainerGenerator generator = base.ItemContainerGenerator; - for (int i = children.Count - 1; i >= 0; i--) - { - GeneratorPosition pos = new GeneratorPosition(i, 0); - int itemIndex = generator.IndexFromGeneratorPosition(pos); - if (itemIndex < minIndex || itemIndex > maxIndex) - { - generator.Remove(pos, 1); - base.RemoveInternalChildRange(i, 1); - } - } - } - private void ArrangeChild(bool isHorizontal, Size finalSize, int index, UIElement child) - { - if (child == null) - { - return; - } - int count = isHorizontal ? this.GetVerticalChildrenCountPerRow(finalSize) : this.GetHorizontalChildrenCountPerRow(finalSize); - int itemIndex = base.ItemContainerGenerator.IndexFromGeneratorPosition(new GeneratorPosition(index, 0)); - int row = isHorizontal ? (itemIndex / count) : (itemIndex % count); - int column = isHorizontal ? (itemIndex % count) : (itemIndex / count); - Rect rect = new Rect((double)column * this.ItemWidth, (double)row * this.ItemHeight, this.ItemWidth, this.ItemHeight); - if (isHorizontal) - { - rect.Y -= this.VerticalOffset; - } - else - { - rect.X -= this.HorizontalOffset; - } - child.Arrange(rect); - } - private void InvalidateScrollInfo(Size availableSize) - { - ItemsControl ownerItemsControl = ItemsControl.GetItemsOwner(this); - if (ownerItemsControl != null) - { - Size extent = this.GetExtent(availableSize, ownerItemsControl.Items.Count); - if (extent != this.contentExtent) - { - this.contentExtent = extent; - this.RefreshOffset(); - } - if (availableSize != this.viewport) - { - this.viewport = availableSize; - this.InvalidateScrollOwner(); - } - } - } - private void RefreshOffset() - { - if (this.Orientation == Orientation.Horizontal) - { - this.SetVerticalOffset(this.VerticalOffset); - return; - } - this.SetHorizontalOffset(this.HorizontalOffset); - } - private void InvalidateScrollOwner() - { - if (this.ScrollOwner != null) - { - this.ScrollOwner.InvalidateScrollInfo(); - } - } - private Size GetExtent(Size availableSize, int itemCount) - { - if (this.Orientation == Orientation.Horizontal) - { - int childrenPerRow = this.GetVerticalChildrenCountPerRow(availableSize); - return new Size((double)childrenPerRow * this.ItemWidth, this.ItemHeight * Math.Ceiling((double)itemCount / (double)childrenPerRow)); - } - int childrenPerRow2 = this.GetHorizontalChildrenCountPerRow(availableSize); - return new Size(this.ItemWidth * Math.Ceiling((double)itemCount / (double)childrenPerRow2), (double)childrenPerRow2 * this.ItemHeight); - } - private int GetVerticalChildrenCountPerRow(Size availableSize) - { - int childrenCountPerRow; - if (availableSize.Width == double.PositiveInfinity) - { - childrenCountPerRow = base.Children.Count; - } - else - { - childrenCountPerRow = Math.Max(1, (int)Math.Floor(availableSize.Width / this.ItemWidth)); - } - return childrenCountPerRow; - } - private int GetHorizontalChildrenCountPerRow(Size availableSize) - { - int childrenCountPerRow; - if (availableSize.Height == double.PositiveInfinity) - { - childrenCountPerRow = base.Children.Count; - } - else - { - childrenCountPerRow = Math.Max(1, (int)Math.Floor(availableSize.Height / this.ItemHeight)); - } - return childrenCountPerRow; - } - - private static bool IsCloseTo(double value1, double value2) - { - return AreClose(value1, value2); - } - - private static bool AreClose(double value1, double value2) - { - if (value1 == value2) - { - return true; - } - double num = (Math.Abs(value1) + Math.Abs(value2) + 10.0) * 2.2204460492503131E-16; - double num2 = value1 - value2; - return -num < num2 && num > num2; - } - } -} \ No newline at end of file diff --git a/MediaBrowser.UI.Uninstall/App.config b/MediaBrowser.UI.Uninstall/App.config deleted file mode 100644 index 8e15646352..0000000000 --- a/MediaBrowser.UI.Uninstall/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/MediaBrowser.UI.Uninstall/Globals.cs b/MediaBrowser.UI.Uninstall/Globals.cs deleted file mode 100644 index aa58e09840..0000000000 --- a/MediaBrowser.UI.Uninstall/Globals.cs +++ /dev/null @@ -1,24 +0,0 @@ - -namespace MediaBrowser.UI.Uninstall -{ - /// - /// Class Globals - /// - public static class Globals - { - /// - /// The product name - /// - public static string ProductName = "Media Browser Theater"; - - /// - /// The suite name - /// - public static string SuiteName = "Media Browser 3"; - - /// - /// The publisher name - /// - public static string PublisherName = "Media Browser Team"; - } -} diff --git a/MediaBrowser.UI.Uninstall/MediaBrowser.UI.Uninstall.csproj b/MediaBrowser.UI.Uninstall/MediaBrowser.UI.Uninstall.csproj deleted file mode 100644 index b54eabc489..0000000000 --- a/MediaBrowser.UI.Uninstall/MediaBrowser.UI.Uninstall.csproj +++ /dev/null @@ -1,68 +0,0 @@ - - - - - Debug - AnyCPU - {E4BE0659-4084-407B-B8A8-67802331CC9E} - Exe - Properties - MediaBrowser.UI.Uninstall - MediaBrowser.UI.Uninstall - v4.5 - 512 - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - - - - - - - - - - - - - - - - - - - - - {cc96bf3e-0bda-4809-bc4b-bb6d418f4a84} - MediaBrowser.ClickOnce - - - - - \ No newline at end of file diff --git a/MediaBrowser.UI.Uninstall/Program.cs b/MediaBrowser.UI.Uninstall/Program.cs deleted file mode 100644 index 14c3d3abfc..0000000000 --- a/MediaBrowser.UI.Uninstall/Program.cs +++ /dev/null @@ -1,30 +0,0 @@ -using MediaBrowser.ClickOnce; -using System; -using System.IO; - -namespace MediaBrowser.UI.Uninstall -{ - /// - /// Class Program - /// - class Program - { - /// - /// Defines the entry point of the application. - /// - /// The args. - static void Main(string[] args) - { - new ClickOnceHelper(Globals.PublisherName, Globals.ProductName, Globals.SuiteName).Uninstall(); - - // Delete all files from publisher folder and folder itself on uninstall - - var publisherFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Globals.PublisherName); - - if (Directory.Exists(publisherFolder)) - { - Directory.Delete(publisherFolder, true); - } - } - } -} diff --git a/MediaBrowser.UI.Uninstall/Properties/AssemblyInfo.cs b/MediaBrowser.UI.Uninstall/Properties/AssemblyInfo.cs deleted file mode 100644 index 258e5d5d66..0000000000 --- a/MediaBrowser.UI.Uninstall/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("MediaBrowser.UI.Uninstall")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("MediaBrowser.UI.Uninstall")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a01e166b-048e-4888-8075-0daf64480c79")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/MediaBrowser.UI.sln b/MediaBrowser.UI.sln deleted file mode 100644 index 8b79d2c6bc..0000000000 --- a/MediaBrowser.UI.sln +++ /dev/null @@ -1,150 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.UI", "MediaBrowser.UI\MediaBrowser.UI.csproj", "{B5ECE1FB-618E-420B-9A99-8E972D76920A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Common", "MediaBrowser.Common\MediaBrowser.Common.csproj", "{9142EEFA-7570-41E1-BFCC-468BB571AF2F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Model", "MediaBrowser.Model\MediaBrowser.Model.csproj", "{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.ApiInteraction", "MediaBrowser.ApiInteraction\MediaBrowser.ApiInteraction.csproj", "{921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Plugins.DefaultTheme", "MediaBrowser.Plugins.DefaultTheme\MediaBrowser.Plugins.DefaultTheme.csproj", "{6E892999-711D-4E24-8BAC-DACF5BFA783A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.UI.Uninstall", "MediaBrowser.UI.Uninstall\MediaBrowser.UI.Uninstall.csproj", "{E4BE0659-4084-407B-B8A8-67802331CC9E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.IsoMounter", "MediaBrowser.IsoMounter\MediaBrowser.IsoMounter.csproj", "{5356AE30-6A6E-4A64-81E3-F76C50595E64}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.UI.Controls", "MediaBrowser.UI.Controls\MediaBrowser.UI.Controls.csproj", "{1ADFE460-FD95-46FA-8871-CCCB4B62E2E8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Logging.NLog", "MediaBrowser.Logging.NLog\MediaBrowser.Logging.NLog.csproj", "{67310740-0EC4-4DC2-9921-33DF38B20167}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.ClickOnce", "MediaBrowser.ClickOnce\MediaBrowser.ClickOnce.csproj", "{CC96BF3E-0BDA-4809-BC4B-BB6D418F4A84}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Debug|x86.ActiveCfg = Debug|Any CPU - {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Debug|x86.Build.0 = Debug|Any CPU - {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Release|Any CPU.Build.0 = Release|Any CPU - {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Release|Mixed Platforms.Build.0 = Release|x86 - {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Release|x86.ActiveCfg = Release|Any CPU - {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Release|x86.Build.0 = Release|Any CPU - {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Debug|x86.ActiveCfg = Debug|Any CPU - {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Debug|x86.Build.0 = Debug|Any CPU - {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Release|Any CPU.Build.0 = Release|Any CPU - {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Release|x86.ActiveCfg = Release|Any CPU - {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Release|x86.Build.0 = Release|Any CPU - {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|x86.ActiveCfg = Debug|Any CPU - {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|x86.Build.0 = Debug|Any CPU - {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release|Any CPU.Build.0 = Release|Any CPU - {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release|x86.ActiveCfg = Release|Any CPU - {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release|x86.Build.0 = Release|Any CPU - {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Debug|Any CPU.Build.0 = Debug|Any CPU - {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Debug|x86.ActiveCfg = Debug|Any CPU - {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Debug|x86.Build.0 = Debug|Any CPU - {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Release|Any CPU.ActiveCfg = Release|Any CPU - {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Release|Any CPU.Build.0 = Release|Any CPU - {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Release|x86.ActiveCfg = Release|Any CPU - {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Release|x86.Build.0 = Release|Any CPU - {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Debug|x86.ActiveCfg = Debug|Any CPU - {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Debug|x86.Build.0 = Debug|Any CPU - {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Release|Any CPU.Build.0 = Release|Any CPU - {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Release|x86.ActiveCfg = Release|Any CPU - {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Release|x86.Build.0 = Release|Any CPU - {E4BE0659-4084-407B-B8A8-67802331CC9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E4BE0659-4084-407B-B8A8-67802331CC9E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E4BE0659-4084-407B-B8A8-67802331CC9E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {E4BE0659-4084-407B-B8A8-67802331CC9E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {E4BE0659-4084-407B-B8A8-67802331CC9E}.Debug|x86.ActiveCfg = Debug|Any CPU - {E4BE0659-4084-407B-B8A8-67802331CC9E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E4BE0659-4084-407B-B8A8-67802331CC9E}.Release|Any CPU.Build.0 = Release|Any CPU - {E4BE0659-4084-407B-B8A8-67802331CC9E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {E4BE0659-4084-407B-B8A8-67802331CC9E}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {E4BE0659-4084-407B-B8A8-67802331CC9E}.Release|x86.ActiveCfg = Release|Any CPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Debug|x86.ActiveCfg = Debug|x86 - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Debug|x86.Build.0 = Debug|x86 - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|Any CPU.Build.0 = Release|Any CPU - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|Mixed Platforms.Build.0 = Release|x86 - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|x86.ActiveCfg = Release|x86 - {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|x86.Build.0 = Release|x86 - {1ADFE460-FD95-46FA-8871-CCCB4B62E2E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1ADFE460-FD95-46FA-8871-CCCB4B62E2E8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1ADFE460-FD95-46FA-8871-CCCB4B62E2E8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {1ADFE460-FD95-46FA-8871-CCCB4B62E2E8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {1ADFE460-FD95-46FA-8871-CCCB4B62E2E8}.Debug|x86.ActiveCfg = Debug|Any CPU - {1ADFE460-FD95-46FA-8871-CCCB4B62E2E8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1ADFE460-FD95-46FA-8871-CCCB4B62E2E8}.Release|Any CPU.Build.0 = Release|Any CPU - {1ADFE460-FD95-46FA-8871-CCCB4B62E2E8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {1ADFE460-FD95-46FA-8871-CCCB4B62E2E8}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {1ADFE460-FD95-46FA-8871-CCCB4B62E2E8}.Release|x86.ActiveCfg = Release|Any CPU - {67310740-0EC4-4DC2-9921-33DF38B20167}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {67310740-0EC4-4DC2-9921-33DF38B20167}.Debug|Any CPU.Build.0 = Debug|Any CPU - {67310740-0EC4-4DC2-9921-33DF38B20167}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {67310740-0EC4-4DC2-9921-33DF38B20167}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {67310740-0EC4-4DC2-9921-33DF38B20167}.Debug|x86.ActiveCfg = Debug|Any CPU - {67310740-0EC4-4DC2-9921-33DF38B20167}.Release|Any CPU.ActiveCfg = Release|Any CPU - {67310740-0EC4-4DC2-9921-33DF38B20167}.Release|Any CPU.Build.0 = Release|Any CPU - {67310740-0EC4-4DC2-9921-33DF38B20167}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {67310740-0EC4-4DC2-9921-33DF38B20167}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {67310740-0EC4-4DC2-9921-33DF38B20167}.Release|x86.ActiveCfg = Release|Any CPU - {CC96BF3E-0BDA-4809-BC4B-BB6D418F4A84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CC96BF3E-0BDA-4809-BC4B-BB6D418F4A84}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CC96BF3E-0BDA-4809-BC4B-BB6D418F4A84}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {CC96BF3E-0BDA-4809-BC4B-BB6D418F4A84}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {CC96BF3E-0BDA-4809-BC4B-BB6D418F4A84}.Debug|x86.ActiveCfg = Debug|Any CPU - {CC96BF3E-0BDA-4809-BC4B-BB6D418F4A84}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CC96BF3E-0BDA-4809-BC4B-BB6D418F4A84}.Release|Any CPU.Build.0 = Release|Any CPU - {CC96BF3E-0BDA-4809-BC4B-BB6D418F4A84}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {CC96BF3E-0BDA-4809-BC4B-BB6D418F4A84}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {CC96BF3E-0BDA-4809-BC4B-BB6D418F4A84}.Release|x86.ActiveCfg = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/MediaBrowser.UI/App.config b/MediaBrowser.UI/App.config deleted file mode 100644 index 72c2c8077e..0000000000 --- a/MediaBrowser.UI/App.config +++ /dev/null @@ -1,28 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.UI/App.xaml b/MediaBrowser.UI/App.xaml deleted file mode 100644 index d8d7a80372..0000000000 --- a/MediaBrowser.UI/App.xaml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.UI/App.xaml.cs b/MediaBrowser.UI/App.xaml.cs deleted file mode 100644 index bcaa0529e6..0000000000 --- a/MediaBrowser.UI/App.xaml.cs +++ /dev/null @@ -1,1098 +0,0 @@ -using MediaBrowser.ApiInteraction; -using MediaBrowser.ClickOnce; -using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Kernel; -using MediaBrowser.IsoMounter; -using MediaBrowser.Logging.Nlog; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Logging; -using MediaBrowser.Model.Net; -using MediaBrowser.Model.Updates; -using MediaBrowser.Model.Weather; -using MediaBrowser.UI.Controller; -using MediaBrowser.UI.Controls; -using MediaBrowser.UI.Pages; -using MediaBrowser.UI.Uninstall; -using Microsoft.Win32; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Net.Cache; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; -using System.Windows.Media.Imaging; - -namespace MediaBrowser.UI -{ - /// - /// Interaction logic for App.xaml - /// - public partial class App : Application, IApplicationHost - { - /// - /// Gets or sets a value indicating whether [last run at startup value]. - /// - /// null if [last run at startup value] contains no value, true if [last run at startup value]; otherwise, false. - private bool? LastRunAtStartupValue { get; set; } - - /// - /// Gets or sets the clock timer. - /// - /// The clock timer. - private Timer ClockTimer { get; set; } - /// - /// Gets or sets the server configuration timer. - /// - /// The server configuration timer. - private Timer ServerConfigurationTimer { get; set; } - - /// - /// The single instance mutex - /// - private Mutex SingleInstanceMutex; - - /// - /// Gets or sets the kernel. - /// - /// The kernel. - protected IKernel Kernel { get; set; } - - /// - /// Gets or sets the logger. - /// - /// The logger. - protected ILogger Logger { get; set; } - - /// - /// Gets or sets the log file path. - /// - /// The log file path. - public string LogFilePath { get; private set; } - - /// - /// Occurs when [property changed]. - /// - public event PropertyChangedEventHandler PropertyChanged; - - /// - /// Gets the name of the product. - /// - /// The name of the product. - protected string ProductName - { - get { return Globals.ProductName; } - } - - /// - /// Gets the name of the publisher. - /// - /// The name of the publisher. - protected string PublisherName - { - get { return Globals.PublisherName; } - } - - /// - /// Gets the name of the suite. - /// - /// The name of the suite. - protected string SuiteName - { - get { return Globals.SuiteName; } - } - - /// - /// Gets the name of the uninstaller file. - /// - /// The name of the uninstaller file. - protected string UninstallerFileName - { - get { return "MediaBrowser.UI.Uninstall.exe"; } - } - - /// - /// The container - /// - private SimpleInjector.Container _container = new SimpleInjector.Container(); - - /// - /// Gets or sets the iso manager. - /// - /// The iso manager. - private IIsoManager IsoManager { get; set; } - - /// - /// Gets the instance. - /// - /// The instance. - public static App Instance - { - get - { - return Current as App; - } - } - - /// - /// Gets the API client. - /// - /// The API client. - public ApiClient ApiClient - { - get { return UIKernel.Instance.ApiClient; } - } - - /// - /// Gets the application window. - /// - /// The application window. - public MainWindow ApplicationWindow { get; private set; } - - /// - /// Gets the hidden window. - /// - /// The hidden window. - public HiddenWindow HiddenWindow { get; private set; } - - /// - /// The _current user - /// - private UserDto _currentUser; - /// - /// Gets or sets the current user. - /// - /// The current user. - public UserDto CurrentUser - { - get - { - return _currentUser; - } - set - { - _currentUser = value; - - if (UIKernel.Instance.ApiClient != null) - { - if (value == null) - { - UIKernel.Instance.ApiClient.CurrentUserId = null; - } - else - { - UIKernel.Instance.ApiClient.CurrentUserId = value.Id; - } - } - - OnPropertyChanged("CurrentUser"); - } - } - - /// - /// The _server configuration - /// - private ServerConfiguration _serverConfiguration; - /// - /// Gets or sets the server configuration. - /// - /// The server configuration. - public ServerConfiguration ServerConfiguration - { - get - { - return _serverConfiguration; - } - set - { - _serverConfiguration = value; - OnPropertyChanged("ServerConfiguration"); - } - } - - /// - /// The _current time - /// - private DateTime _currentTime = DateTime.Now; - /// - /// Gets the current time. - /// - /// The current time. - public DateTime CurrentTime - { - get - { - return _currentTime; - } - private set - { - _currentTime = value; - OnPropertyChanged("CurrentTime"); - } - } - - /// - /// The _current weather - /// - private WeatherInfo _currentWeather; - /// - /// Gets the current weather. - /// - /// The current weather. - public WeatherInfo CurrentWeather - { - get - { - return _currentWeather; - } - private set - { - _currentWeather = value; - OnPropertyChanged("CurrentWeather"); - } - } - - /// - /// The _current theme - /// - private BaseTheme _currentTheme; - /// - /// Gets the current theme. - /// - /// The current theme. - public BaseTheme CurrentTheme - { - get - { - return _currentTheme; - } - private set - { - _currentTheme = value; - OnPropertyChanged("CurrentTheme"); - } - } - - /// - /// Defines the entry point of the application. - /// - [STAThread] - public static void Main() - { - var application = new App(new NLogger("App")); - application.InitializeComponent(); - - application.Run(); - } - - /// - /// Initializes a new instance of the class. - /// - /// The logger. - public App(ILogger logger) - { - Logger = logger; - - InitializeComponent(); - } - - /// - /// Instantiates the main window. - /// - /// Window. - protected Window InstantiateMainWindow() - { - HiddenWindow = new HiddenWindow { }; - - return HiddenWindow; - } - - /// - /// Shows the application window. - /// - private void ShowApplicationWindow() - { - var win = new MainWindow(Logger); - - var config = UIKernel.Instance.Configuration; - - // Restore window position/size - if (config.WindowState.HasValue) - { - // Set window state - win.WindowState = config.WindowState.Value; - - // Set position if not maximized - if (config.WindowState.Value != WindowState.Maximized) - { - double left = 0; - double top = 0; - - // Set left - if (config.WindowLeft.HasValue) - { - win.WindowStartupLocation = WindowStartupLocation.Manual; - win.Left = left = Math.Max(config.WindowLeft.Value, 0); - } - - // Set top - if (config.WindowTop.HasValue) - { - win.WindowStartupLocation = WindowStartupLocation.Manual; - win.Top = top = Math.Max(config.WindowTop.Value, 0); - } - - // Set width - if (config.WindowWidth.HasValue) - { - win.Width = Math.Min(config.WindowWidth.Value, SystemParameters.VirtualScreenWidth - left); - } - - // Set height - if (config.WindowHeight.HasValue) - { - win.Height = Math.Min(config.WindowHeight.Value, SystemParameters.VirtualScreenHeight - top); - } - } - } - - win.LocationChanged += ApplicationWindow_LocationChanged; - win.StateChanged += ApplicationWindow_LocationChanged; - win.SizeChanged += ApplicationWindow_LocationChanged; - - ApplicationWindow = win; - - ApplicationWindow.Show(); - - ApplicationWindow.Owner = HiddenWindow; - - SyncHiddenWindowLocation(); - } - - /// - /// Handles the LocationChanged event of the ApplicationWindow control. - /// - /// The source of the event. - /// The instance containing the event data. - void ApplicationWindow_LocationChanged(object sender, EventArgs e) - { - SyncHiddenWindowLocation(); - } - - /// - /// Syncs the hidden window location. - /// - public void SyncHiddenWindowLocation() - { - HiddenWindow.Width = ApplicationWindow.Width; - HiddenWindow.Height = ApplicationWindow.Height; - HiddenWindow.Top = ApplicationWindow.Top; - HiddenWindow.Left = ApplicationWindow.Left; - HiddenWindow.WindowState = ApplicationWindow.WindowState; - - ApplicationWindow.Activate(); - } - - /// - /// Loads the kernel. - /// - protected async void LoadKernel() - { - // Without this the app will shutdown after the splash screen closes - ShutdownMode = ShutdownMode.OnExplicitShutdown; - - RegisterResources(); - - Kernel = new UIKernel(this, Logger); - - try - { - var now = DateTime.UtcNow; - - await Kernel.Init(); - - Logger.Info("Kernel.Init completed in {0} seconds.", (DateTime.UtcNow - now).TotalSeconds); - - ShutdownMode = System.Windows.ShutdownMode.OnLastWindowClose; - - OnKernelLoaded(); - - InstantiateMainWindow().Show(); - - ShowApplicationWindow(); - - await ApplicationWindow.LoadInitialUI().ConfigureAwait(false); - } - catch (Exception ex) - { - Logger.ErrorException("Error launching application", ex); - - MessageBox.Show("There was an error launching Media Browser: " + ex.Message); - - // Shutdown the app with an error code - Shutdown(1); - } - } - - /// - /// Called when [kernel loaded]. - /// - /// Task. - protected void OnKernelLoaded() - { - Kernel.ConfigurationUpdated += Kernel_ConfigurationUpdated; - - ConfigureClickOnceStartup(); - - PropertyChanged += AppPropertyChanged; - - // Update every 10 seconds - ClockTimer = new Timer(ClockTimerCallback, null, 0, 10000); - - // Update every 30 minutes - ServerConfigurationTimer = new Timer(ServerConfigurationTimerCallback, null, 0, 1800000); - - CurrentTheme = UIKernel.Instance.Themes.First(); - - foreach (var resource in CurrentTheme.GetGlobalResources()) - { - Resources.MergedDictionaries.Add(resource); - } - } - - /// - /// Raises the event. - /// - /// A that contains the event data. - protected override void OnStartup(StartupEventArgs e) - { - bool createdNew; - SingleInstanceMutex = new Mutex(true, @"Local\" + GetType().Assembly.GetName().Name, out createdNew); - if (!createdNew) - { - SingleInstanceMutex = null; - Shutdown(); - return; - } - - AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; - LoadKernel(); - - SystemEvents.SessionEnding += SystemEvents_SessionEnding; - } - - /// - /// Handles the UnhandledException event of the CurrentDomain control. - /// - /// The source of the event. - /// The instance containing the event data. - void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) - { - var exception = (Exception)e.ExceptionObject; - - Logger.ErrorException("UnhandledException", exception); - - MessageBox.Show("Unhandled exception: " + exception.Message); - } - - /// - /// Called when [property changed]. - /// - /// The info. - public void OnPropertyChanged(String info) - { - if (PropertyChanged != null) - { - try - { - PropertyChanged(this, new PropertyChangedEventArgs(info)); - } - catch (Exception ex) - { - Logger.ErrorException("Error in event handler", ex); - } - } - } - - /// - /// Handles the SessionEnding event of the SystemEvents control. - /// - /// The source of the event. - /// The instance containing the event data. - void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e) - { - // Try to shut down gracefully - Shutdown(); - } - - /// - /// Raises the event. - /// - /// An that contains the event data. - protected override void OnExit(ExitEventArgs e) - { - var win = ApplicationWindow; - - if (win != null) - { - // Save window position - var config = UIKernel.Instance.Configuration; - config.WindowState = win.WindowState; - config.WindowTop = win.Top; - config.WindowLeft = win.Left; - config.WindowWidth = win.Width; - config.WindowHeight = win.Height; - UIKernel.Instance.SaveConfiguration(); - } - - ReleaseMutex(); - - base.OnExit(e); - - Kernel.Dispose(); - } - - /// - /// Releases the mutex. - /// - private void ReleaseMutex() - { - if (SingleInstanceMutex == null) - { - return; - } - - SingleInstanceMutex.ReleaseMutex(); - SingleInstanceMutex.Close(); - SingleInstanceMutex.Dispose(); - SingleInstanceMutex = null; - } - - /// - /// Apps the property changed. - /// - /// The sender. - /// The instance containing the event data. - async void AppPropertyChanged(object sender, PropertyChangedEventArgs e) - { - if (e.PropertyName.Equals("ServerConfiguration")) - { - if (string.IsNullOrEmpty(ServerConfiguration.WeatherLocation)) - { - CurrentWeather = null; - } - else - { - try - { - CurrentWeather = await ApiClient.GetWeatherInfoAsync(ServerConfiguration.WeatherLocation); - } - catch (HttpException ex) - { - Logger.ErrorException("Error downloading weather information", ex); - } - } - } - } - - /// - /// Clocks the timer callback. - /// - /// The state info. - private void ClockTimerCallback(object stateInfo) - { - CurrentTime = DateTime.Now; - } - - /// - /// Servers the configuration timer callback. - /// - /// The state info. - private async void ServerConfigurationTimerCallback(object stateInfo) - { - try - { - var b = Kernel; - //ServerConfiguration = await ApiClient.GetServerConfigurationAsync(); - } - catch (HttpException ex) - { - Logger.ErrorException("Error refreshing server configuration", ex); - } - } - - /// - /// Logouts the user. - /// - /// Task. - public async Task LogoutUser() - { - CurrentUser = null; - - await Dispatcher.InvokeAsync(() => Navigate(CurrentTheme.GetLoginPage())); - } - - /// - /// Navigates the specified page. - /// - /// The page. - public void Navigate(Page page) - { - _remoteImageCache = new FileSystemRepository(UIKernel.Instance.ApplicationPaths.RemoteImageCachePath); - - ApplicationWindow.Navigate(page); - } - - /// - /// Navigates to settings page. - /// - public void NavigateToSettingsPage() - { - Navigate(new SettingsPage()); - } - - /// - /// Navigates to internal player page. - /// - public void NavigateToInternalPlayerPage() - { - Navigate(CurrentTheme.GetInternalPlayerPage()); - } - - /// - /// Navigates to image viewer. - /// - /// The image URL. - /// The caption. - public void OpenImageViewer(Uri imageUrl, string caption) - { - var tuple = new Tuple(imageUrl, caption); - - OpenImageViewer(new[] { tuple }); - } - - /// - /// Navigates to image viewer. - /// - /// The images. - public void OpenImageViewer(IEnumerable> images) - { - new ImageViewerWindow(images).ShowModal(ApplicationWindow); - } - - /// - /// Navigates to item. - /// - /// The item. - public void NavigateToItem(BaseItemDto item) - { - if (item.IsRoot.HasValue && item.IsRoot.Value) - { - NavigateToHomePage(); - } - else if (item.IsFolder) - { - Navigate(CurrentTheme.GetListPage(item)); - } - else - { - Navigate(CurrentTheme.GetDetailPage(item)); - } - } - - /// - /// Displays the weather. - /// - public void DisplayWeather() - { - CurrentTheme.DisplayWeather(); - } - - /// - /// Navigates to home page. - /// - public void NavigateToHomePage() - { - Navigate(CurrentTheme.GetHomePage()); - } - - /// - /// Shows a notification message that will disappear on it's own - /// - /// The text. - /// The caption. - /// The icon. - public void ShowNotificationMessage(string text, string caption = null, MessageBoxIcon icon = MessageBoxIcon.None) - { - ApplicationWindow.ShowModalMessage(text, caption: caption, icon: icon); - } - - /// - /// Shows a notification message that will disappear on it's own - /// - /// The text. - /// The caption. - /// The icon. - public void ShowNotificationMessage(UIElement text, string caption = null, MessageBoxIcon icon = MessageBoxIcon.None) - { - ApplicationWindow.ShowModalMessage(text, caption: caption, icon: icon); - } - - /// - /// Shows a modal message box and asynchronously returns a MessageBoxResult - /// - /// The text. - /// The caption. - /// The button. - /// The icon. - /// MessageBoxResult. - public MessageBoxResult ShowModalMessage(string text, string caption = null, MessageBoxButton button = MessageBoxButton.OK, MessageBoxIcon icon = MessageBoxIcon.None) - { - return ApplicationWindow.ShowModalMessage(text, caption: caption, button: button, icon: icon); - } - - /// - /// Shows a modal message box and asynchronously returns a MessageBoxResult - /// - /// The text. - /// The caption. - /// The button. - /// The icon. - /// MessageBoxResult. - public MessageBoxResult ShowModalMessage(UIElement text, string caption = null, MessageBoxButton button = MessageBoxButton.OK, MessageBoxIcon icon = MessageBoxIcon.None) - { - return ApplicationWindow.ShowModalMessage(text, caption: caption, button: button, icon: icon); - } - - /// - /// Shows the error message. - /// - /// The message. - /// The caption. - public void ShowErrorMessage(string message, string caption = null) - { - caption = caption ?? "Error"; - ShowModalMessage(message, caption: caption, button: MessageBoxButton.OK, icon: MessageBoxIcon.Error); - } - - /// - /// Shows the default error message. - /// - public void ShowDefaultErrorMessage() - { - ShowErrorMessage("There was an error processing the request", "Error"); - } - - /// - /// The _remote image cache - /// - private FileSystemRepository _remoteImageCache; - - /// - /// Gets the remote image async. - /// - /// The URL. - /// Task{Image}. - public async Task GetRemoteImageAsync(string url) - { - var bitmap = await GetRemoteBitmapAsync(url); - - return new Image { Source = bitmap }; - } - - /// - /// Gets the remote image async. - /// - /// The URL. - /// Task{BitmapImage}. - /// url - public Task GetRemoteBitmapAsync(string url) - { - if (string.IsNullOrEmpty(url)) - { - throw new ArgumentNullException("url"); - } - - Logger.Info("Image url: " + url); - - return Task.Run(async () => - { - var cachePath = _remoteImageCache.GetResourcePath(url.GetMD5().ToString()); - - await _remoteImageCache.WaitForLockAsync(cachePath).ConfigureAwait(false); - - var releaseLock = true; - try - { - using (var stream = new FileStream(cachePath, FileMode.Open, FileAccess.Read, FileShare.Read, StreamDefaults.DefaultFileStreamBufferSize, true)) - { - return await GetRemoteBitmapAsync(stream).ConfigureAwait(false); - } - } - catch (FileNotFoundException) - { - // Doesn't exist. No biggie - releaseLock = false; - } - finally - { - if (releaseLock) - { - _remoteImageCache.ReleaseLock(cachePath); - } - } - - try - { - using (var httpStream = await UIKernel.Instance.ApiClient.GetImageStreamAsync(url + "&x=1")) - { - return await GetRemoteBitmapAsync(httpStream, cachePath); - } - } - finally - { - _remoteImageCache.ReleaseLock(cachePath); - } - }); - } - - /// - /// Gets the image async. - /// - /// The source stream. - /// The cache path. - /// Task{BitmapImage}. - private async Task GetRemoteBitmapAsync(Stream sourceStream, string cachePath = null) - { - byte[] bytes; - - using (var ms = new MemoryStream()) - { - await sourceStream.CopyToAsync(ms).ConfigureAwait(false); - - bytes = ms.ToArray(); - } - - if (!string.IsNullOrEmpty(cachePath)) - { - using (var fileStream = new FileStream(cachePath, FileMode.Create, FileAccess.Write, FileShare.Read, StreamDefaults.DefaultFileStreamBufferSize, true)) - { - await fileStream.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false); - } - } - - using (Stream stream = new MemoryStream(bytes)) - { - var bitmapImage = new BitmapImage - { - CreateOptions = BitmapCreateOptions.DelayCreation - }; - - bitmapImage.BeginInit(); - bitmapImage.CacheOption = BitmapCacheOption.OnLoad; - bitmapImage.StreamSource = stream; - bitmapImage.EndInit(); - bitmapImage.Freeze(); - return bitmapImage; - } - } - - /// - /// Handles the ConfigurationUpdated event of the Kernel control. - /// - /// The source of the event. - /// The instance containing the event data. - void Kernel_ConfigurationUpdated(object sender, EventArgs e) - { - if (!LastRunAtStartupValue.HasValue || LastRunAtStartupValue.Value != Kernel.Configuration.RunAtStartup) - { - ConfigureClickOnceStartup(); - } - } - - /// - /// Configures the click once startup. - /// - private void ConfigureClickOnceStartup() - { - try - { - ClickOnceHelper.ConfigureClickOnceStartupIfInstalled(PublisherName, ProductName, SuiteName, Kernel.Configuration.RunAtStartup, UninstallerFileName); - - LastRunAtStartupValue = Kernel.Configuration.RunAtStartup; - } - catch (Exception ex) - { - Logger.ErrorException("Error configuring ClickOnce", ex); - } - } - - public void Restart() - { - Dispatcher.Invoke(ReleaseMutex); - - Kernel.Dispose(); - - System.Windows.Forms.Application.Restart(); - - Dispatcher.Invoke(Shutdown); - } - - public void ReloadLogger() - { - LogFilePath = Path.Combine(Kernel.ApplicationPaths.LogDirectoryPath, "Server-" + DateTime.Now.Ticks + ".log"); - - NlogManager.AddFileTarget(LogFilePath, Kernel.Configuration.EnableDebugLevelLogging); - } - - /// - /// Gets the bitmap image. - /// - /// The URI. - /// BitmapImage. - /// uri - public BitmapImage GetBitmapImage(string uri) - { - if (string.IsNullOrEmpty(uri)) - { - throw new ArgumentNullException("uri"); - } - - return GetBitmapImage(new Uri(uri)); - } - - /// - /// Gets the bitmap image. - /// - /// The URI. - /// BitmapImage. - /// uri - public BitmapImage GetBitmapImage(Uri uri) - { - if (uri == null) - { - throw new ArgumentNullException("uri"); - } - - var bitmap = new BitmapImage - { - CreateOptions = BitmapCreateOptions.DelayCreation, - CacheOption = BitmapCacheOption.OnDemand, - UriCachePolicy = new RequestCachePolicy(RequestCacheLevel.CacheIfAvailable) - }; - - bitmap.BeginInit(); - bitmap.UriSource = uri; - bitmap.EndInit(); - - RenderOptions.SetBitmapScalingMode(bitmap, BitmapScalingMode.Fant); - return bitmap; - } - - /// - /// Gets or sets a value indicating whether this instance can self update. - /// - /// true if this instance can self update; otherwise, false. - public bool CanSelfUpdate - { - get { return ClickOnceHelper.IsNetworkDeployed; } - } - - /// - /// Checks for update. - /// - /// The cancellation token. - /// The progress. - /// Task{CheckForUpdateResult}. - public Task CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress progress) - { - return new ApplicationUpdateCheck().CheckForApplicationUpdate(cancellationToken, progress); - } - - /// - /// Registers resources that classes will depend on - /// - private void RegisterResources() - { - Register(this); - Register(Logger); - - IsoManager = new PismoIsoManager(Logger); - - Register(IsoManager); - } - - /// - /// Updates the application. - /// - /// The cancellation token. - /// The progress. - /// Task. - public Task UpdateApplication(CancellationToken cancellationToken, IProgress progress) - { - return new ApplicationUpdater().UpdateApplication(cancellationToken, progress); - } - - /// - /// Creates an instance of type and resolves all constructor dependancies - /// - /// The type. - /// System.Object. - public object CreateInstance(Type type) - { - try - { - return _container.GetInstance(type); - } - catch - { - Logger.Error("Error creating {0}", type.Name); - - throw; - } - } - - /// - /// Registers the specified obj. - /// - /// - /// The obj. - public void Register(T obj) - where T : class - { - _container.RegisterSingle(obj); - } - - /// - /// Resolves this instance. - /// - /// - /// ``0. - public T Resolve() - { - return (T)_container.GetRegistration(typeof(T), true).GetInstance(); - } - - /// - /// Resolves this instance. - /// - /// - /// ``0. - public T TryResolve() - { - var result = _container.GetRegistration(typeof(T), false); - - if (result == null) - { - return default(T); - } - return (T)result.GetInstance(); - } - } -} diff --git a/MediaBrowser.UI/Configuration/PlayerConfiguration.cs b/MediaBrowser.UI/Configuration/PlayerConfiguration.cs deleted file mode 100644 index c00f49b5e9..0000000000 --- a/MediaBrowser.UI/Configuration/PlayerConfiguration.cs +++ /dev/null @@ -1,52 +0,0 @@ -using MediaBrowser.Model.Entities; - -namespace MediaBrowser.UI.Configuration -{ - /// - /// Class PlayerConfiguration - /// - public class PlayerConfiguration - { - /// - /// Gets or sets the name of the player. - /// - /// The name of the player. - public string PlayerName { get; set; } - - /// - /// Gets or sets the item types. - /// - /// The item types. - public string[] ItemTypes { get; set; } - - /// - /// Gets or sets the file extensions. - /// - /// The file extensions. - public string[] FileExtensions { get; set; } - - /// - /// Gets or sets the video types. - /// - /// The video types. - public VideoType[] VideoTypes { get; set; } - - /// - /// Gets or sets the video formats. - /// - /// The video formats. - public VideoFormat[] VideoFormats { get; set; } - - /// - /// Gets or sets the command. - /// - /// The command. - public string Command { get; set; } - - /// - /// Gets or sets the args. - /// - /// The args. - public string Args { get; set; } - } -} diff --git a/MediaBrowser.UI/Configuration/UIApplicationConfiguration.cs b/MediaBrowser.UI/Configuration/UIApplicationConfiguration.cs deleted file mode 100644 index 7038339249..0000000000 --- a/MediaBrowser.UI/Configuration/UIApplicationConfiguration.cs +++ /dev/null @@ -1,72 +0,0 @@ -using MediaBrowser.Model.Configuration; -using System.Windows; - -namespace MediaBrowser.UI.Configuration -{ - /// - /// This is the UI's device configuration that applies regardless of which user is logged in. - /// - public class UIApplicationConfiguration : BaseApplicationConfiguration - { - /// - /// Gets or sets the server host name (myserver or 192.168.x.x) - /// - /// The name of the server host. - public string ServerHostName { get; set; } - - /// - /// Gets or sets the port number used by the API - /// - /// The server API port. - public int ServerApiPort { get; set; } - - /// - /// Gets or sets the player configurations. - /// - /// The player configurations. - public PlayerConfiguration[] MediaPlayers { get; set; } - - /// - /// Gets or sets the state of the window. - /// - /// The state of the window. - public WindowState? WindowState { get; set; } - - /// - /// Gets or sets the window top. - /// - /// The window top. - public double? WindowTop { get; set; } - - /// - /// Gets or sets the window left. - /// - /// The window left. - public double? WindowLeft { get; set; } - - /// - /// Gets or sets the width of the window. - /// - /// The width of the window. - public double? WindowWidth { get; set; } - - /// - /// Gets or sets the height of the window. - /// - /// The height of the window. - public double? WindowHeight { get; set; } - - /// - /// Initializes a new instance of the class. - /// - public UIApplicationConfiguration() - : base() - { - ServerHostName = "localhost"; - ServerApiPort = 8096; - - // Need a different default than the server - LegacyWebSocketPortNumber = 8946; - } - } -} diff --git a/MediaBrowser.UI/Configuration/UIApplicationPaths.cs b/MediaBrowser.UI/Configuration/UIApplicationPaths.cs deleted file mode 100644 index 313c310d3e..0000000000 --- a/MediaBrowser.UI/Configuration/UIApplicationPaths.cs +++ /dev/null @@ -1,37 +0,0 @@ -using MediaBrowser.Common.Kernel; -using System.IO; - -namespace MediaBrowser.UI.Configuration -{ - /// - /// Class UIApplicationPaths - /// - public class UIApplicationPaths : BaseApplicationPaths - { - /// - /// The _remote image cache path - /// - private string _remoteImageCachePath; - /// - /// Gets the remote image cache path. - /// - /// The remote image cache path. - public string RemoteImageCachePath - { - get - { - if (_remoteImageCachePath == null) - { - _remoteImageCachePath = Path.Combine(CachePath, "remote-images"); - - if (!Directory.Exists(_remoteImageCachePath)) - { - Directory.CreateDirectory(_remoteImageCachePath); - } - } - - return _remoteImageCachePath; - } - } - } -} diff --git a/MediaBrowser.UI/Controller/BaseTheme.cs b/MediaBrowser.UI/Controller/BaseTheme.cs deleted file mode 100644 index bcf882f689..0000000000 --- a/MediaBrowser.UI/Controller/BaseTheme.cs +++ /dev/null @@ -1,60 +0,0 @@ -using MediaBrowser.Model.Dto; -using System; -using System.Collections.Generic; -using System.Windows; -using System.Windows.Controls; - -namespace MediaBrowser.UI.Controller -{ - /// - /// Class BaseTheme - /// - public abstract class BaseTheme : IDisposable - { - /// - /// Gets the global resources. - /// - /// IEnumerable{ResourceDictionary}. - public abstract IEnumerable GetGlobalResources(); - - /// - /// Gets the list page. - /// - /// The item. - /// Page. - public abstract Page GetListPage(BaseItemDto item); - /// - /// Gets the detail page. - /// - /// The item. - /// Page. - public abstract Page GetDetailPage(BaseItemDto item); - /// - /// Gets the home page. - /// - /// Page. - public abstract Page GetHomePage(); - /// - /// Gets the login page. - /// - /// Page. - public abstract Page GetLoginPage(); - /// - /// Gets the internal player page. - /// - /// Page. - public abstract Page GetInternalPlayerPage(); - - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public virtual void Dispose() - { - } - - /// - /// Displays the weather. - /// - public abstract void DisplayWeather(); - } -} diff --git a/MediaBrowser.UI/Controller/PluginUpdater.cs b/MediaBrowser.UI/Controller/PluginUpdater.cs deleted file mode 100644 index e56b6f54f2..0000000000 --- a/MediaBrowser.UI/Controller/PluginUpdater.cs +++ /dev/null @@ -1,313 +0,0 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Model.Logging; -using MediaBrowser.Model.Net; -using MediaBrowser.Model.Plugins; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Threading.Tasks; - -namespace MediaBrowser.UI.Controller -{ - /// - /// This keeps ui plugin assemblies in sync with plugins installed on the server - /// - public class PluginUpdater - { - private readonly ILogger _logger; - - public PluginUpdater(ILogger logger) - { - _logger = logger; - } - - /// - /// Updates the plugins. - /// - /// Task{PluginUpdateResult}. - public async Task UpdatePlugins() - { - _logger.Info("Downloading list of installed plugins"); - var allInstalledPlugins = await UIKernel.Instance.ApiClient.GetInstalledPluginsAsync().ConfigureAwait(false); - - var uiPlugins = allInstalledPlugins.Where(p => p.DownloadToUI).ToList(); - - var result = new PluginUpdateResult { }; - - result.DeletedPlugins = DeleteUninstalledPlugins(uiPlugins); - - await DownloadPluginAssemblies(uiPlugins, result).ConfigureAwait(false); - - result.UpdatedConfigurations = await DownloadPluginConfigurations(uiPlugins).ConfigureAwait(false); - - return result; - } - - /// - /// Downloads plugin assemblies from the server, if they need to be installed or updated. - /// - /// The UI plugins. - /// The result. - /// Task. - private async Task DownloadPluginAssemblies(IEnumerable uiPlugins, PluginUpdateResult result) - { - var newlyInstalledPlugins = new List(); - var updatedPlugins = new List(); - - // Loop through the list of plugins that are on the server - foreach (var pluginInfo in uiPlugins) - { - // See if it is already installed in the UI - var currentAssemblyPath = Path.Combine(UIKernel.Instance.ApplicationPaths.PluginsPath, pluginInfo.AssemblyFileName); - - var isPluginInstalled = File.Exists(currentAssemblyPath); - - // Download the plugin if it is not present, or if the current version is out of date - bool downloadPlugin; - - if (!isPluginInstalled) - { - downloadPlugin = true; - _logger.Info("{0} is not installed and needs to be downloaded.", pluginInfo.Name); - } - else - { - var serverVersion = Version.Parse(pluginInfo.Version); - - var fileVersion = FileVersionInfo.GetVersionInfo(currentAssemblyPath).FileVersion ?? string.Empty; - - downloadPlugin = string.IsNullOrEmpty(fileVersion) || Version.Parse(fileVersion) < serverVersion; - - if (downloadPlugin) - { - _logger.Info("{0} has an updated version on the server and needs to be downloaded. Server version: {1}, UI version: {2}", pluginInfo.Name, serverVersion, fileVersion); - } - } - - if (downloadPlugin) - { - if (UIKernel.Instance.ApplicationVersion < Version.Parse(pluginInfo.MinimumRequiredUIVersion)) - { - _logger.Warn("Can't download new version of {0} because the application needs to be updated first.", pluginInfo.Name); - continue; - } - - try - { - await DownloadPlugin(pluginInfo).ConfigureAwait(false); - - if (isPluginInstalled) - { - updatedPlugins.Add(pluginInfo); - } - else - { - newlyInstalledPlugins.Add(pluginInfo); - } - } - catch (HttpException ex) - { - _logger.ErrorException("Error downloading {0} configuration", ex, pluginInfo.Name); - } - catch (IOException ex) - { - _logger.ErrorException("Error saving plugin assembly for {0}", ex, pluginInfo.Name); - } - } - } - - result.NewlyInstalledPlugins = newlyInstalledPlugins; - result.UpdatedPlugins = updatedPlugins; - } - - /// - /// Downloads plugin configurations from the server. - /// - /// The UI plugins. - /// Task{List{PluginInfo}}. - private async Task> DownloadPluginConfigurations(IEnumerable uiPlugins) - { - var updatedPlugins = new List(); - - // Loop through the list of plugins that are on the server - foreach (var pluginInfo in uiPlugins - .Where(p => UIKernel.Instance.ApplicationVersion >= Version.Parse(p.MinimumRequiredUIVersion))) - { - // See if it is already installed in the UI - var path = Path.Combine(UIKernel.Instance.ApplicationPaths.PluginConfigurationsPath, pluginInfo.ConfigurationFileName); - - var download = false; - - if (!File.Exists(path)) - { - download = true; - _logger.Info("{0} configuration was not found needs to be downloaded.", pluginInfo.Name); - } - else if (File.GetLastWriteTimeUtc(path) < pluginInfo.ConfigurationDateLastModified) - { - download = true; - _logger.Info("{0} has an updated configuration on the server and needs to be downloaded.", pluginInfo.Name); - } - - if (download) - { - if (UIKernel.Instance.ApplicationVersion < Version.Parse(pluginInfo.MinimumRequiredUIVersion)) - { - _logger.Warn("Can't download updated configuration of {0} because the application needs to be updated first.", pluginInfo.Name); - continue; - } - - try - { - await DownloadPluginConfiguration(pluginInfo, path).ConfigureAwait(false); - - updatedPlugins.Add(pluginInfo); - } - catch (HttpException ex) - { - _logger.ErrorException("Error downloading {0} configuration", ex, pluginInfo.Name); - } - catch (IOException ex) - { - _logger.ErrorException("Error saving plugin configuration to {0}", ex, path); - } - } - } - - return updatedPlugins; - } - - /// - /// Downloads a plugin assembly from the server - /// - /// The plugin. - /// Task. - private async Task DownloadPlugin(PluginInfo plugin) - { - _logger.Info("Downloading {0} Plugin", plugin.Name); - - var path = Path.Combine(UIKernel.Instance.ApplicationPaths.PluginsPath, plugin.AssemblyFileName); - - // First download to a MemoryStream. This way if the download is cut off, we won't be left with a partial file - using (var memoryStream = new MemoryStream()) - { - var assemblyStream = await UIKernel.Instance.ApiClient.GetPluginAssemblyAsync(plugin).ConfigureAwait(false); - - await assemblyStream.CopyToAsync(memoryStream).ConfigureAwait(false); - - memoryStream.Position = 0; - - using (var fileStream = new FileStream(path, FileMode.Create)) - { - await memoryStream.CopyToAsync(fileStream).ConfigureAwait(false); - } - } - } - - /// - /// Downloads the latest configuration for a plugin - /// - /// The plugin info. - /// The path. - /// Task. - private async Task DownloadPluginConfiguration(PluginInfo pluginInfo, string path) - { - _logger.Info("Downloading {0} Configuration", pluginInfo.Name); - - // First download to a MemoryStream. This way if the download is cut off, we won't be left with a partial file - using (var stream = await UIKernel.Instance.ApiClient.GetPluginConfigurationFileAsync(pluginInfo.Id).ConfigureAwait(false)) - { - using (var memoryStream = new MemoryStream()) - { - await stream.CopyToAsync(memoryStream).ConfigureAwait(false); - - memoryStream.Position = 0; - - using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, StreamDefaults.DefaultFileStreamBufferSize, true)) - { - await memoryStream.CopyToAsync(fs).ConfigureAwait(false); - } - } - } - - File.SetLastWriteTimeUtc(path, pluginInfo.ConfigurationDateLastModified); - } - - /// - /// Deletes any plugins that have been uninstalled from the server - /// - /// The UI plugins. - /// IEnumerable{System.String}. - private IEnumerable DeleteUninstalledPlugins(IEnumerable uiPlugins) - { - var deletedPlugins = new List(); - - foreach (var plugin in Directory.EnumerateFiles(UIKernel.Instance.ApplicationPaths.PluginsPath, "*.dll", SearchOption.TopDirectoryOnly) - .Select(Path.GetFileName) - .ToList()) - { - var serverPlugin = uiPlugins.FirstOrDefault(p => p.AssemblyFileName.Equals(plugin, StringComparison.OrdinalIgnoreCase)); - - if (serverPlugin == null) - { - try - { - DeletePlugin(plugin); - - deletedPlugins.Add(plugin); - } - catch (IOException ex) - { - _logger.ErrorException("Error deleting plugin assembly {0}", ex, plugin); - } - } - } - - return deletedPlugins; - } - - /// - /// Deletes an installed ui plugin. - /// Leaves config and data behind in the event it is later re-installed - /// - /// The plugin. - private void DeletePlugin(string plugin) - { - _logger.Info("Deleting {0} Plugin", plugin); - - if (File.Exists(plugin)) - { - File.Delete(plugin); - } - } - } - - /// - /// Class PluginUpdateResult - /// - public class PluginUpdateResult - { - /// - /// Gets or sets the deleted plugins. - /// - /// The deleted plugins. - public IEnumerable DeletedPlugins { get; set; } - /// - /// Gets or sets the newly installed plugins. - /// - /// The newly installed plugins. - public IEnumerable NewlyInstalledPlugins { get; set; } - /// - /// Gets or sets the updated plugins. - /// - /// The updated plugins. - public IEnumerable UpdatedPlugins { get; set; } - /// - /// Gets or sets the updated configurations. - /// - /// The updated configurations. - public IEnumerable UpdatedConfigurations { get; set; } - } -} diff --git a/MediaBrowser.UI/Controller/UIKernel.cs b/MediaBrowser.UI/Controller/UIKernel.cs deleted file mode 100644 index 118067140f..0000000000 --- a/MediaBrowser.UI/Controller/UIKernel.cs +++ /dev/null @@ -1,181 +0,0 @@ -using MediaBrowser.ApiInteraction; -using MediaBrowser.Common.Kernel; -using MediaBrowser.Model.Connectivity; -using MediaBrowser.Model.Logging; -using MediaBrowser.Model.Net; -using MediaBrowser.UI.Configuration; -using MediaBrowser.UI.Playback; -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.Cache; -using System.Net.Http; -using System.Threading.Tasks; - -namespace MediaBrowser.UI.Controller -{ - /// - /// This controls application logic as well as server interaction within the UI. - /// - public class UIKernel : BaseKernel - { - /// - /// Gets the instance. - /// - /// The instance. - public static UIKernel Instance { get; private set; } - - /// - /// Gets the API client. - /// - /// The API client. - public ApiClient ApiClient { get; private set; } - - /// - /// Gets the playback manager. - /// - /// The playback manager. - public PlaybackManager PlaybackManager { get; private set; } - - /// - /// Initializes a new instance of the class. - /// - public UIKernel(IApplicationHost appHost, ILogger logger) - : base(appHost, logger) - { - Instance = this; - } - - /// - /// Gets the media players. - /// - /// The media players. - public IEnumerable MediaPlayers { get; private set; } - - /// - /// Gets the list of currently loaded themes - /// - /// The themes. - public IEnumerable Themes { get; private set; } - - /// - /// Gets the kernel context. - /// - /// The kernel context. - public override KernelContext KernelContext - { - get { return KernelContext.Ui; } - } - - /// - /// Gets the UDP server port number. - /// - /// The UDP server port number. - public override int UdpServerPortNumber - { - get { return 7360; } - } - - /// - /// Give the UI a different url prefix so that they can share the same port, in case they are installed on the same machine. - /// - /// The HTTP server URL prefix. - public override string HttpServerUrlPrefix - { - get - { - return "http://+:" + Configuration.HttpServerPortNumber + "/mediabrowserui/"; - } - } - - /// - /// Reload api client and update plugins after loading configuration - /// - /// Task. - protected override async Task OnConfigurationLoaded() - { - ReloadApiClient(); - - try - { - await new PluginUpdater(Logger).UpdatePlugins().ConfigureAwait(false); - } - catch (HttpException ex) - { - Logger.ErrorException("Error updating plugins from the server", ex); - } - } - - /// - /// Disposes the current ApiClient and creates a new one - /// - private void ReloadApiClient() - { - DisposeApiClient(); - - ApiClient = new ApiClient(Logger, new AsyncHttpClient(new WebRequestHandler - { - AutomaticDecompression = DecompressionMethods.Deflate, - CachePolicy = new RequestCachePolicy(RequestCacheLevel.Revalidate) - })) - { - ServerHostName = Configuration.ServerHostName, - ServerApiPort = Configuration.ServerApiPort, - ClientType = ClientType.Pc, - DeviceName = Environment.MachineName, - SerializationFormat = SerializationFormats.Json - }; - } - - /// - /// Finds the parts. - /// - /// All types. - protected override void FindParts(Type[] allTypes) - { - PlaybackManager = (PlaybackManager)ApplicationHost.CreateInstance(typeof(PlaybackManager)); - - base.FindParts(allTypes); - - Themes = GetExports(allTypes); - MediaPlayers = GetExports(allTypes); - } - - /// - /// Called when [composable parts loaded]. - /// - /// Task. - protected override async Task OnComposablePartsLoaded() - { - await base.OnComposablePartsLoaded().ConfigureAwait(false); - - // Once plugins have loaded give the api a reference to our protobuf serializer - DataSerializer.DynamicSerializer = ProtobufSerializer.TypeModel; - } - - /// - /// Disposes the current ApiClient - /// - private void DisposeApiClient() - { - if (ApiClient != null) - { - ApiClient.Dispose(); - } - } - - /// - /// Releases unmanaged and - optionally - managed resources. - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected override void Dispose(bool dispose) - { - if (dispose) - { - DisposeApiClient(); - } - - base.Dispose(dispose); - } - } -} diff --git a/MediaBrowser.UI/Controls/ModalWindow.xaml b/MediaBrowser.UI/Controls/ModalWindow.xaml deleted file mode 100644 index c2afbe05e2..0000000000 --- a/MediaBrowser.UI/Controls/ModalWindow.xaml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MediaBrowser.UI/Controls/ModalWindow.xaml.cs b/MediaBrowser.UI/Controls/ModalWindow.xaml.cs deleted file mode 100644 index 21f97b8ac0..0000000000 --- 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 -{ - /// - /// Interaction logic for ModalWindow.xaml - /// - 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; - } - } - - /// - /// 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. - /// - 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 020fecd6d5..0000000000 --- a/MediaBrowser.UI/Controls/NavigationBar.xaml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MediaBrowser.UI/Controls/NavigationBar.xaml.cs b/MediaBrowser.UI/Controls/NavigationBar.xaml.cs deleted file mode 100644 index 6d59a7d3a3..0000000000 --- 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 -{ - /// - /// Interaction logic for NavigationBar.xaml - /// - public partial class NavigationBar : BaseUserControl - { - /// - /// Gets or sets the current player. - /// - /// The current player. - private BaseMediaPlayer CurrentPlayer { get; set; } - - /// - /// Gets or sets the current position timer. - /// - /// The current position timer. - private Timer CurrentPositionTimer { get; set; } - - /// - /// Initializes a new instance of the class. - /// - public NavigationBar() - { - InitializeComponent(); - - Loaded += NavigationBar_Loaded; - } - - /// - /// Handles the Loaded event of the NavigationBar control. - /// - /// The source of the event. - /// The instance containing the event data. - 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; - } - - /// - /// Handles the Click event of the PreviousChapterButton control. - /// - /// The source of the event. - /// The instance containing the event data. - async void PreviousChapterButton_Click(object sender, RoutedEventArgs e) - { - await CurrentPlayer.GoToPreviousChapter(); - } - - /// - /// Handles the Click event of the NextChapterButton control. - /// - /// The source of the event. - /// The instance containing the event data. - async void NextChapterButton_Click(object sender, RoutedEventArgs e) - { - await CurrentPlayer.GoToNextChapter(); - } - - /// - /// Handles the Click event of the PauseButton control. - /// - /// The source of the event. - /// The instance containing the event data. - async void PauseButton_Click(object sender, RoutedEventArgs e) - { - await CurrentPlayer.Pause(); - } - - /// - /// Handles the Click event of the PlayButton control. - /// - /// The source of the event. - /// The instance containing the event data. - async void PlayButton_Click(object sender, RoutedEventArgs e) - { - await CurrentPlayer.UnPause(); - } - - /// - /// Handles the Click event of the StopButton control. - /// - /// The source of the event. - /// The instance containing the event data. - async void StopButton_Click(object sender, RoutedEventArgs e) - { - await CurrentPlayer.Stop(); - } - - /// - /// Handles the PlaybackCompleted event of the PlaybackManager control. - /// - /// The source of the event. - /// The instance containing the event data. - 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); - } - } - - /// - /// Handles the Click event of the VolumeUpButton control. - /// - /// The source of the event. - /// The instance containing the event data. - void VolumeUpButton_Click(object sender, RoutedEventArgs e) - { - CurrentPlayer.Volume += 3; - } - - /// - /// Handles the Click event of the VolumeDownButton control. - /// - /// The source of the event. - /// The instance containing the event data. - void VolumeDownButton_Click(object sender, RoutedEventArgs e) - { - CurrentPlayer.Volume -= 3; - } - - /// - /// Handles the Click event of the MuteButton control. - /// - /// The source of the event. - /// The instance containing the event data. - void MuteButton_Click(object sender, RoutedEventArgs e) - { - if (CurrentPlayer.CanMute) - { - CurrentPlayer.Mute = !CurrentPlayer.Mute; - } - } - - /// - /// Handles the PlaybackStarted event of the PlaybackManager control. - /// - /// The source of the event. - /// The instance containing the event data. - 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); - } - } - - /// - /// Currents the position timer callback. - /// - /// The state. - 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; - } - }); - } - - /// - /// Gets the time string. - /// - /// The ticks. - /// System.String. - private string GetTimeString(long ticks) - { - var timespan = TimeSpan.FromTicks(ticks); - - return timespan.TotalHours >= 1 ? timespan.ToString("hh':'mm':'ss") : timespan.ToString("mm':'ss"); - } - - /// - /// Handles the PlayStateChanged event of the CurrentPlayer control. - /// - /// The source of the event. - /// The instance containing the event data. - void CurrentPlayer_PlayStateChanged(object sender, EventArgs e) - { - ResetButtonVisibilities(CurrentPlayer); - } - - /// - /// Resets the button visibilities. - /// - /// The player. - 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; - }); - } - - /// - /// BTNs the application back click. - /// - /// The sender. - /// The instance containing the event data. - void BtnApplicationBackClick(object sender, RoutedEventArgs e) - { - App.Instance.ApplicationWindow.NavigateBack(); - } - - /// - /// The is position slider dragging - /// - private bool _isPositionSliderDragging; - - /// - /// Handles the DragStarted event of the CurrentPositionSlider control. - /// - /// The source of the event. - /// The instance containing the event data. - private void CurrentPositionSlider_DragStarted(object sender, DragStartedEventArgs e) - { - _isPositionSliderDragging = true; - } - - /// - /// Handles the DragCompleted event of the CurrentPositionSlider control. - /// - /// The source of the event. - /// The instance containing the event data. - private void CurrentPositionSlider_DragCompleted(object sender, DragCompletedEventArgs e) - { - _isPositionSliderDragging = false; - - //await CurrentPlayer.Seek(Convert.ToInt64(CurrentPositionSlider.Value)); - } - - /// - /// Handles the PreviewMouseUp event of the CurrentPositionSlider control. - /// - /// The source of the event. - /// The instance containing the event data. - 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 6411b6f57a..0000000000 --- a/MediaBrowser.UI/Controls/NotificationMessage.xaml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MediaBrowser.UI/Controls/NotificationMessage.xaml.cs b/MediaBrowser.UI/Controls/NotificationMessage.xaml.cs deleted file mode 100644 index 06ed513b13..0000000000 --- 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 -{ - /// - /// Interaction logic for NotificationMessage.xaml - /// - 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 bca8812385..0000000000 --- a/MediaBrowser.UI/Controls/WindowCommands.xaml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MediaBrowser.UI/Controls/WindowCommands.xaml.cs b/MediaBrowser.UI/Controls/WindowCommands.xaml.cs deleted file mode 100644 index e285cced12..0000000000 --- a/MediaBrowser.UI/Controls/WindowCommands.xaml.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System.Windows; -using System.Windows.Controls; - -namespace MediaBrowser.UI.Controls -{ - /// - /// Interaction logic for WindowCommands.xaml - /// - public partial class WindowCommands : UserControl - { - /// - /// Gets the parent window. - /// - /// The parent window. - public Window ParentWindow - { - get { return TreeHelper.TryFindParent(this); } - } - - /// - /// Initializes a new instance of the class. - /// - public WindowCommands() - { - InitializeComponent(); - Loaded += WindowCommandsLoaded; - } - - /// - /// Windows the commands loaded. - /// - /// The sender. - /// The instance containing the event data. - void WindowCommandsLoaded(object sender, RoutedEventArgs e) - { - CloseApplicationButton.Click += CloseApplicationButtonClick; - MinimizeApplicationButton.Click += MinimizeApplicationButtonClick; - MaximizeApplicationButton.Click += MaximizeApplicationButtonClick; - UndoMaximizeApplicationButton.Click += UndoMaximizeApplicationButtonClick; - } - - /// - /// Undoes the maximize application button click. - /// - /// The sender. - /// The instance containing the event data. - void UndoMaximizeApplicationButtonClick(object sender, RoutedEventArgs e) - { - ParentWindow.WindowState = WindowState.Normal; - } - - /// - /// Maximizes the application button click. - /// - /// The sender. - /// The instance containing the event data. - void MaximizeApplicationButtonClick(object sender, RoutedEventArgs e) - { - ParentWindow.WindowState = WindowState.Maximized; - } - - /// - /// Minimizes the application button click. - /// - /// The sender. - /// The instance containing the event data. - void MinimizeApplicationButtonClick(object sender, RoutedEventArgs e) - { - ParentWindow.WindowState = WindowState.Minimized; - } - - /// - /// Closes the application button click. - /// - /// The sender. - /// The instance containing the event data. - void CloseApplicationButtonClick(object sender, RoutedEventArgs e) - { - App.Instance.Shutdown(); - } - } -} diff --git a/MediaBrowser.UI/Converters/BaseItemImageVisibilityConverter.cs b/MediaBrowser.UI/Converters/BaseItemImageVisibilityConverter.cs deleted file mode 100644 index 6e69326fcf..0000000000 --- a/MediaBrowser.UI/Converters/BaseItemImageVisibilityConverter.cs +++ /dev/null @@ -1,75 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using System; -using System.Windows; -using System.Windows.Data; - -namespace MediaBrowser.UI.Converters -{ - /// - /// Class BaseItemImageVisibilityConverter - /// - class BaseItemImageVisibilityConverter : IValueConverter - { - /// - /// Converts a value. - /// - /// The value produced by the binding source. - /// The type of the binding target property. - /// The converter parameter to use. - /// The culture to use in the converter. - /// A converted value. If the method returns null, the valid null value is used. - public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - var item = value as BaseItemDto; - - if (item != null) - { - var paramString = parameter as string; - - var vals = paramString.Split(','); - - var imageType = (ImageType)Enum.Parse(typeof(ImageType), vals[0], true); - bool reverse = vals.Length > 1 && vals[1].Equals("reverse", StringComparison.OrdinalIgnoreCase); - - return GetVisibility(item, imageType, reverse); - } - - return Visibility.Collapsed; - } - - /// - /// Gets the visibility. - /// - /// The item. - /// The type. - /// if set to true [reverse]. - /// Visibility. - private Visibility GetVisibility(BaseItemDto item, ImageType type, bool reverse) - { - var hasImageVisibility = reverse ? Visibility.Collapsed : Visibility.Visible; - var hasNoImageVisibility = reverse ? Visibility.Visible : Visibility.Collapsed; - - if (type == ImageType.Logo) - { - return item.HasLogo || !string.IsNullOrEmpty(item.ParentLogoItemId) ? hasImageVisibility : hasNoImageVisibility; - } - - return item.HasPrimaryImage ? hasImageVisibility : hasNoImageVisibility; - } - - /// - /// Converts a value. - /// - /// The value that is produced by the binding target. - /// The type to convert to. - /// The converter parameter to use. - /// The culture to use in the converter. - /// A converted value. If the method returns null, the valid null value is used. - /// - public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/MediaBrowser.UI/Converters/CurrentUserVisibilityConverter.cs b/MediaBrowser.UI/Converters/CurrentUserVisibilityConverter.cs deleted file mode 100644 index c7853ea9c6..0000000000 --- a/MediaBrowser.UI/Converters/CurrentUserVisibilityConverter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Globalization; -using System.Windows; -using System.Windows.Data; - -namespace MediaBrowser.UI.Converters -{ - public class CurrentUserVisibilityConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (App.Instance.ServerConfiguration == null) - { - return Visibility.Collapsed; - } - - return value == null ? Visibility.Collapsed : Visibility.Visible; - } - - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/MediaBrowser.UI/Converters/DateTimeToStringConverter.cs b/MediaBrowser.UI/Converters/DateTimeToStringConverter.cs deleted file mode 100644 index f0c93e7d5b..0000000000 --- a/MediaBrowser.UI/Converters/DateTimeToStringConverter.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Globalization; -using System.Windows.Data; - -namespace MediaBrowser.UI.Converters -{ - public class DateTimeToStringConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - var date = (DateTime)value; - - string format = parameter as string; - - if (string.IsNullOrEmpty(format)) - { - return date.ToString(); - } - - // If a theme asks for this, they know it's only going to work if the current culture is en-us - if (format.Equals("timesuffixlower", StringComparison.OrdinalIgnoreCase)) - { - if (CultureInfo.CurrentCulture.Name.Equals("en-US", StringComparison.OrdinalIgnoreCase)) - { - var time = date.ToString("t"); - var values = time.Split(' '); - return values[values.Length - 1].ToLower(); - } - return string.Empty; - } - - return date.ToString(format); - } - - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/MediaBrowser.UI/Converters/LastSeenTextConverter.cs b/MediaBrowser.UI/Converters/LastSeenTextConverter.cs deleted file mode 100644 index 13e6c54b96..0000000000 --- a/MediaBrowser.UI/Converters/LastSeenTextConverter.cs +++ /dev/null @@ -1,86 +0,0 @@ -using MediaBrowser.Model.Dto; -using System; -using System.Globalization; -using System.Windows.Data; - -namespace MediaBrowser.UI.Converters -{ - public class LastSeenTextConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - var user = value as UserDto; - - if (user != null) - { - if (user.LastActivityDate.HasValue) - { - DateTime date = user.LastActivityDate.Value.ToLocalTime(); - - return "Last seen " + GetRelativeTimeText(date); - } - } - - return null; - } - - private static string GetRelativeTimeText(DateTime date) - { - TimeSpan ts = DateTime.Now - date; - - const int second = 1; - const int minute = 60 * second; - const int hour = 60 * minute; - const int day = 24 * hour; - const int month = 30 * day; - - int delta = System.Convert.ToInt32(ts.TotalSeconds); - - if (delta < 0) - { - return "not yet"; - } - if (delta < 1 * minute) - { - return ts.Seconds == 1 ? "one second ago" : ts.Seconds + " seconds ago"; - } - if (delta < 2 * minute) - { - return "a minute ago"; - } - if (delta < 45 * minute) - { - return ts.Minutes + " minutes ago"; - } - if (delta < 90 * minute) - { - return "an hour ago"; - } - if (delta < 24 * hour) - { - return ts.Hours == 1 ? "an hour ago" : ts.Hours + " hours ago"; - } - if (delta < 48 * hour) - { - return "yesterday"; - } - if (delta < 30 * day) - { - return ts.Days + " days ago"; - } - if (delta < 12 * month) - { - int months = System.Convert.ToInt32(Math.Floor((double)ts.Days / 30)); - return months <= 1 ? "one month ago" : months + " months ago"; - } - - int years = System.Convert.ToInt32(Math.Floor((double)ts.Days / 365)); - return years <= 1 ? "one year ago" : years + " years ago"; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/MediaBrowser.UI/Converters/MetroTileBackgroundConverter.cs b/MediaBrowser.UI/Converters/MetroTileBackgroundConverter.cs deleted file mode 100644 index 6279711e2a..0000000000 --- a/MediaBrowser.UI/Converters/MetroTileBackgroundConverter.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Globalization; -using System.Windows.Data; -using System.Windows.Media; - -namespace MediaBrowser.UI.Converters -{ - /// - /// Generates a random metro-friendly background color - /// - public class MetroTileBackgroundConverter : IValueConverter - { - private static readonly Brush[] TileColors = new Brush[] { - new SolidColorBrush(Color.FromRgb((byte)111,(byte)189,(byte)69)), - new SolidColorBrush(Color.FromRgb((byte)75,(byte)179,(byte)221)), - new SolidColorBrush(Color.FromRgb((byte)65,(byte)100,(byte)165)), - new SolidColorBrush(Color.FromRgb((byte)225,(byte)32,(byte)38)), - new SolidColorBrush(Color.FromRgb((byte)128,(byte)0,(byte)128)), - new SolidColorBrush(Color.FromRgb((byte)0,(byte)128,(byte)64)), - new SolidColorBrush(Color.FromRgb((byte)0,(byte)148,(byte)255)), - new SolidColorBrush(Color.FromRgb((byte)255,(byte)0,(byte)199)), - new SolidColorBrush(Color.FromRgb((byte)255,(byte)135,(byte)15)), - new SolidColorBrush(Color.FromRgb((byte)127,(byte)0,(byte)55)) - - }; - - private static int _currentIndex = new Random(DateTime.Now.Millisecond).Next(0, TileColors.Length); - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return GetRandomBackground(); - } - - public static Brush GetRandomBackground() - { - int index; - - lock (TileColors) - { - index = (_currentIndex++) % TileColors.Length; - } - - return TileColors[index++]; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new System.NotImplementedException(); - } - } -} diff --git a/MediaBrowser.UI/Converters/UserImageConverter.cs b/MediaBrowser.UI/Converters/UserImageConverter.cs deleted file mode 100644 index f979107c88..0000000000 --- a/MediaBrowser.UI/Converters/UserImageConverter.cs +++ /dev/null @@ -1,97 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Net; -using System; -using System.Globalization; -using System.Windows.Data; - -namespace MediaBrowser.UI.Converters -{ - /// - /// Class UserImageConverter - /// - public class UserImageConverter : IValueConverter - { - /// - /// Converts a value. - /// - /// The value produced by the binding source. - /// The type of the binding target property. - /// The converter parameter to use. - /// The culture to use in the converter. - /// A converted value. If the method returns null, the valid null value is used. - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - var user = value as UserDto; - - if (user != null && user.HasPrimaryImage) - { - var config = parameter as string; - - int? maxWidth = null; - int? maxHeight = null; - int? width = null; - int? height = null; - - if (!string.IsNullOrEmpty(config)) - { - var vals = config.Split(','); - - width = GetSize(vals[0]); - height = GetSize(vals[1]); - maxWidth = GetSize(vals[2]); - maxHeight = GetSize(vals[3]); - } - - var uri = App.Instance.ApiClient.GetUserImageUrl(user, new ImageOptions - { - Width = width, - Height = height, - MaxWidth = maxWidth, - MaxHeight = maxHeight, - Quality = 100 - }); - - try - { - return App.Instance.GetRemoteBitmapAsync(uri).Result; - } - catch (HttpException) - { - - } - } - - return null; - } - - /// - /// Gets the size. - /// - /// The val. - /// System.Nullable{System.Int32}. - private int? GetSize(string val) - { - if (string.IsNullOrEmpty(val) || val == "0") - { - return null; - } - - return int.Parse(val); - } - - - /// - /// Converts a value. - /// - /// The value that is produced by the binding target. - /// The type to convert to. - /// The converter parameter to use. - /// The culture to use in the converter. - /// A converted value. If the method returns null, the valid null value is used. - /// - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/MediaBrowser.UI/Converters/WatchedVisibilityConverter.cs b/MediaBrowser.UI/Converters/WatchedVisibilityConverter.cs deleted file mode 100644 index 797bb54880..0000000000 --- a/MediaBrowser.UI/Converters/WatchedVisibilityConverter.cs +++ /dev/null @@ -1,117 +0,0 @@ -using MediaBrowser.Model.Dto; -using System; -using System.Globalization; -using System.Windows; -using System.Windows.Data; - -namespace MediaBrowser.UI.Converters -{ - public class WatchedVisibilityConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - var item = value as BaseItemDto; - - if (item == null) - { - return null; - } - - if (item.IsFolder) - { - return item.PlayedPercentage.HasValue && item.PlayedPercentage.Value == 100 ? Visibility.Visible : Visibility.Collapsed; - } - - if (item.UserData == null) - { - return Visibility.Collapsed; - } - - return item.UserData.PlayCount == 0 ? Visibility.Collapsed : Visibility.Visible; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } - - public class FavoriteVisibilityConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - var item = value as BaseItemDto; - - if (item == null) - { - return null; - } - - if (item.UserData == null) - { - return Visibility.Collapsed; - } - - return item.UserData.IsFavorite ? Visibility.Visible : Visibility.Collapsed; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } - - public class LikeVisibilityConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - var item = value as BaseItemDto; - - if (item == null) - { - return null; - } - - if (item.UserData == null) - { - return Visibility.Collapsed; - } - - var userdata = item.UserData; - - return userdata.Likes.HasValue && userdata.Likes.Value && !userdata.IsFavorite ? Visibility.Visible : Visibility.Collapsed; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } - - public class DislikeVisibilityConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - var item = value as BaseItemDto; - - if (item == null) - { - return null; - } - - if (item.UserData == null) - { - return Visibility.Collapsed; - } - - var userdata = item.UserData; - - return userdata.Likes.HasValue && !userdata.Likes.Value && !userdata.IsFavorite ? Visibility.Visible : Visibility.Collapsed; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/MediaBrowser.UI/Converters/WeatherTemperatureConverter.cs b/MediaBrowser.UI/Converters/WeatherTemperatureConverter.cs deleted file mode 100644 index c297df4f0a..0000000000 --- a/MediaBrowser.UI/Converters/WeatherTemperatureConverter.cs +++ /dev/null @@ -1,31 +0,0 @@ -using MediaBrowser.Model.Weather; -using System; -using System.Globalization; -using System.Windows.Data; - -namespace MediaBrowser.UI.Converters -{ - public class WeatherTemperatureConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - var weather = value as WeatherInfo; - - if (weather != null && weather.CurrentWeather != null) - { - if (App.Instance.ServerConfiguration.WeatherUnit == WeatherUnits.Celsius) - { - return weather.CurrentWeather.TemperatureCelsius + "°C"; - } - - return weather.CurrentWeather.TemperatureFahrenheit + "°F"; - } - return null; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/MediaBrowser.UI/Converters/WeatherVisibilityConverter.cs b/MediaBrowser.UI/Converters/WeatherVisibilityConverter.cs deleted file mode 100644 index 5706ecec9e..0000000000 --- a/MediaBrowser.UI/Converters/WeatherVisibilityConverter.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Globalization; -using System.Windows; -using System.Windows.Data; - -namespace MediaBrowser.UI.Converters -{ - public class WeatherVisibilityConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return value == null ? Visibility.Collapsed : Visibility.Visible; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/MediaBrowser.UI/Extensions/Extensions.cs b/MediaBrowser.UI/Extensions/Extensions.cs deleted file mode 100644 index 1d0d7d1c2d..0000000000 --- a/MediaBrowser.UI/Extensions/Extensions.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Windows.Threading; - -namespace MediaBrowser.UI.Extensions -{ - public static class Extensions - { - /// - /// Invokes an action after a specified delay - /// - /// The dispatcher. - /// The action. - /// The delay ms. - public static void InvokeWithDelay(this Dispatcher dispatcher, Action action, long delayMs) - { - var timer = new DispatcherTimer(DispatcherPriority.Normal, dispatcher); - timer.Interval = TimeSpan.FromMilliseconds(delayMs); - timer.Tick += (sender, args) => - { - timer.Stop(); - action(); - }; - timer.Start(); - } - } -} diff --git a/MediaBrowser.UI/HiddenWindow.xaml b/MediaBrowser.UI/HiddenWindow.xaml deleted file mode 100644 index 60afccbe76..0000000000 --- a/MediaBrowser.UI/HiddenWindow.xaml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - diff --git a/MediaBrowser.UI/HiddenWindow.xaml.cs b/MediaBrowser.UI/HiddenWindow.xaml.cs deleted file mode 100644 index e2f8f7a37e..0000000000 --- a/MediaBrowser.UI/HiddenWindow.xaml.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Windows; -using MediaBrowser.UI.Controller; - -namespace MediaBrowser.UI -{ - /// - /// Interaction logic for HiddenWindow.xaml - /// - public partial class HiddenWindow : Window - { - /// - /// Initializes a new instance of the class. - /// - public HiddenWindow() - { - InitializeComponent(); - - Loaded += HiddenWindow_Loaded; - } - - /// - /// Handles the Loaded event of the HiddenWindow control. - /// - /// The source of the event. - /// The instance containing the event data. - void HiddenWindow_Loaded(object sender, RoutedEventArgs e) - { - Title += " " + UIKernel.Instance.ApplicationVersion.ToString(); - } - } -} diff --git a/MediaBrowser.UI/ImageViewerWindow.xaml b/MediaBrowser.UI/ImageViewerWindow.xaml deleted file mode 100644 index a36bcf42fd..0000000000 --- a/MediaBrowser.UI/ImageViewerWindow.xaml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - diff --git a/MediaBrowser.UI/ImageViewerWindow.xaml.cs b/MediaBrowser.UI/ImageViewerWindow.xaml.cs deleted file mode 100644 index a8baa3e9f1..0000000000 --- a/MediaBrowser.UI/ImageViewerWindow.xaml.cs +++ /dev/null @@ -1,41 +0,0 @@ -using MediaBrowser.UI.Controls; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace MediaBrowser.UI -{ - /// - /// Interaction logic for ImageViewerWindow.xaml - /// - public partial class ImageViewerWindow : BaseModalWindow - { - /// - /// Gets or sets the images. - /// - /// The images. - private IEnumerable> Images { get; set; } - - /// - /// Initializes a new instance of the class. - /// - /// The images. - public ImageViewerWindow(IEnumerable> images) - : base() - { - InitializeComponent(); - - Images = images; - } - - /// - /// Called when [loaded]. - /// - protected override void OnLoaded() - { - base.OnLoaded(); - - //Image.Source = App.Instance.GetBitmapImage(Images.First().Item1); - } - } -} diff --git a/MediaBrowser.UI/MainWindow.xaml b/MediaBrowser.UI/MainWindow.xaml deleted file mode 100644 index 6e8d494ef6..0000000000 --- a/MediaBrowser.UI/MainWindow.xaml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MediaBrowser.UI/MainWindow.xaml.cs b/MediaBrowser.UI/MainWindow.xaml.cs deleted file mode 100644 index d3307e9132..0000000000 --- a/MediaBrowser.UI/MainWindow.xaml.cs +++ /dev/null @@ -1,507 +0,0 @@ -using MediaBrowser.Common.Extensions; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Logging; -using MediaBrowser.Model.Net; -using MediaBrowser.UI.Controller; -using MediaBrowser.UI.Controls; -using System; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using MediaBrowser.UI.Extensions; - -namespace MediaBrowser.UI -{ - /// - /// Interaction logic for MainWindow.xaml - /// - public partial class MainWindow : BaseWindow, IDisposable - { - /// - /// Gets or sets the mouse idle timer. - /// - /// The mouse idle timer. - private Timer MouseIdleTimer { get; set; } - /// - /// Gets or sets the backdrop timer. - /// - /// The backdrop timer. - private Timer BackdropTimer { get; set; } - /// - /// Gets or sets the current backdrops. - /// - /// The current backdrops. - private string[] CurrentBackdrops { get; set; } - - /// - /// The _current backdrop index - /// - private int _currentBackdropIndex; - /// - /// Gets or sets the index of the current backdrop. - /// - /// The index of the current backdrop. - public int CurrentBackdropIndex - { - get { return _currentBackdropIndex; } - set - { - _currentBackdropIndex = value; - OnPropertyChanged("CurrentBackdropIndex"); - Dispatcher.InvokeAsync(OnBackdropIndexChanged); - } - } - - /// - /// The _is mouse idle - /// - private bool _isMouseIdle = true; - /// - /// Gets or sets a value indicating whether this instance is mouse idle. - /// - /// true if this instance is mouse idle; otherwise, false. - public bool IsMouseIdle - { - get { return _isMouseIdle; } - set - { - _isMouseIdle = value; - - Dispatcher.InvokeAsync(() => Cursor = value ? Cursors.None : Cursors.Arrow); - - OnPropertyChanged("IsMouseIdle"); - } - } - - private readonly ILogger _logger; - - /// - /// Initializes a new instance of the class. - /// - public MainWindow(ILogger logger) - : base() - { - _logger = logger; - - InitializeComponent(); - } - - /// - /// Called when [loaded]. - /// - protected override void OnLoaded() - { - base.OnLoaded(); - - DragBar.MouseDown += DragableGridMouseDown; - - DataContext = App.Instance; - } - - /// - /// Loads the initial UI. - /// - /// Task. - internal Task LoadInitialUI() - { - return LoadInitialPage(); - } - - /// - /// Called when [backdrop index changed]. - /// - private async void OnBackdropIndexChanged() - { - var currentBackdropIndex = CurrentBackdropIndex; - - if (currentBackdropIndex == -1 ) - { - // Setting this to null doesn't seem to clear out the content - // Have to check it for null or get startup errors - if (BackdropContainer.Content != null) - { - BackdropContainer.Content = new FrameworkElement(); - } - return; - } - - try - { - var bitmap = await App.Instance.GetRemoteBitmapAsync(CurrentBackdrops[currentBackdropIndex]); - - var img = new Image - { - Source = bitmap - }; - - img.SetResourceReference(StyleProperty, "BackdropImage"); - - BackdropContainer.Content = img; - } - catch (HttpException) - { - if (currentBackdropIndex == 0) - { - BackdropContainer.Content = new FrameworkElement(); - } - } - } - - /// - /// Loads the initial page. - /// - /// Task. - private Task LoadInitialPage() - { - return App.Instance.LogoutUser(); - } - - /// - /// Dragables the grid mouse down. - /// - /// The sender. - /// The instance containing the event data. - private void DragableGridMouseDown(object sender, MouseButtonEventArgs e) - { - if (e.ClickCount == 2) - { - WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; - } - else if (e.LeftButton == MouseButtonState.Pressed) - { - DragMove(); - } - } - - /// - /// Gets the page frame. - /// - /// The page frame. - private TransitionFrame PageFrame - { - get - { - // Finding the grid that is generated by the ControlTemplate of the Button - return TreeHelper.FindChild(PageContent, "PageFrame"); - } - } - - /// - /// Navigates the specified page. - /// - /// The page. - internal void Navigate(Page page) - { - _logger.Info("Navigating to " + page.GetType().Name); - - Dispatcher.InvokeAsync(() => PageFrame.NavigateWithTransition(page)); - } - - /// - /// Sets the backdrop based on a BaseItemDto - /// - /// The item. - public void SetBackdrops(BaseItemDto item) - { - var urls = App.Instance.ApiClient.GetBackdropImageUrls(item, new ImageOptions - { - MaxWidth = Convert.ToInt32(SystemParameters.VirtualScreenWidth), - MaxHeight = Convert.ToInt32(SystemParameters.VirtualScreenHeight) - }); - - SetBackdrops(urls); - } - - /// - /// Sets the backdrop based on a list of image files - /// - /// The backdrops. - public void SetBackdrops(string[] backdrops) - { - // Don't reload the same backdrops - if (CurrentBackdrops != null && backdrops.SequenceEqual(CurrentBackdrops)) - { - return; - } - - DisposeBackdropTimer(); - CurrentBackdrops = backdrops; - - if (backdrops == null || backdrops.Length == 0) - { - CurrentBackdropIndex = -1; - - // Setting this to null doesn't seem to clear out the content - // Have to check it for null or get startup errors - if (BackdropContainer.Content != null) - { - BackdropContainer.Content = new FrameworkElement(); - } - return; - } - - CurrentBackdropIndex = 0; - - // We only need the timer if there's more than one backdrop - if (backdrops != null && backdrops.Length > 1) - { - BackdropTimer = new Timer(state => - { - // Don't display backdrops during video playback - if (UIKernel.Instance.PlaybackManager.ActivePlayers.Any(p => p.CurrentMedia.IsVideo)) - { - return; - } - - var index = CurrentBackdropIndex + 1; - - if (index >= backdrops.Length) - { - index = 0; - } - - CurrentBackdropIndex = index; - - }, null, 5000, 5000); - } - } - - /// - /// Disposes the backdrop timer. - /// - public void DisposeBackdropTimer() - { - if (BackdropTimer != null) - { - BackdropTimer.Dispose(); - } - } - - /// - /// Disposes the mouse idle timer. - /// - public void DisposeMouseIdleTimer() - { - if (MouseIdleTimer != null) - { - MouseIdleTimer.Dispose(); - } - } - - /// - /// Clears the backdrops. - /// - public void ClearBackdrops() - { - SetBackdrops(new string[] { }); - } - - /// - /// Navigates the back. - /// - public void NavigateBack() - { - Dispatcher.InvokeAsync(() => - { - if (PageFrame.NavigationService.CanGoBack) - { - PageFrame.GoBackWithTransition(); - } - }); - } - - /// - /// Navigates the forward. - /// - public void NavigateForward() - { - Dispatcher.InvokeAsync(() => - { - if (PageFrame.NavigationService.CanGoForward) - { - PageFrame.GoForwardWithTransition(); - } - }); - } - - /// - /// Called when [browser back]. - /// - protected override void OnBrowserBack() - { - base.OnBrowserBack(); - - NavigateBack(); - } - - /// - /// Called when [browser forward]. - /// - protected override void OnBrowserForward() - { - base.OnBrowserForward(); - - NavigateForward(); - } - - /// - /// Shows the control bar then starts a timer to hide it - /// - private void StartMouseIdleTimer() - { - IsMouseIdle = false; - - const int duration = 4000; - - // Start the timer if it's null, otherwise reset it - if (MouseIdleTimer == null) - { - MouseIdleTimer = new Timer(MouseIdleTimerCallback, null, duration, Timeout.Infinite); - } - else - { - MouseIdleTimer.Change(duration, Timeout.Infinite); - } - } - - /// - /// This is the Timer callback method to hide the control bar - /// - /// The state info. - private void MouseIdleTimerCallback(object stateInfo) - { - IsMouseIdle = true; - - if (MouseIdleTimer != null) - { - MouseIdleTimer.Dispose(); - MouseIdleTimer = null; - } - } - - /// - /// The _last mouse move point - /// - private Point _lastMouseMovePoint; - - /// - /// Handles OnMouseMove to show the control box - /// - /// The that contains the event data. - protected override void OnMouseMove(MouseEventArgs e) - { - base.OnMouseMove(e); - - // Store the last position for comparison purposes - // Even if the mouse is not moving this event will fire as elements are showing and hiding - var pos = e.GetPosition(this); - - if (pos == _lastMouseMovePoint) - { - return; - } - - _lastMouseMovePoint = pos; - - StartMouseIdleTimer(); - } - - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - DisposeBackdropTimer(); - DisposeMouseIdleTimer(); - } - - /// - /// Shows a notification message that will disappear on it's own - /// - /// The text. - /// The caption. - /// The icon. - public void ShowNotificationMessage(string text, string caption = null, MessageBoxIcon icon = MessageBoxIcon.None) - { - var control = new NotificationMessage - { - Caption = caption, - Text = text, - MessageBoxImage = icon - }; - - mainGrid.Children.Add(control); - - Dispatcher.InvokeWithDelay(() => mainGrid.Children.Remove(control), 5000); - } - - /// - /// Shows a notification message that will disappear on it's own - /// - /// The text. - /// The caption. - /// The icon. - public void ShowNotificationMessage(UIElement text, string caption = null, MessageBoxIcon icon = MessageBoxIcon.None) - { - var control = new NotificationMessage - { - Caption = caption, - TextContent = text, - MessageBoxImage = icon - }; - - mainGrid.Children.Add(control); - - Dispatcher.InvokeWithDelay(() => mainGrid.Children.Remove(control), 5000); - } - - /// - /// Shows a modal message box and asynchronously returns a MessageBoxResult - /// - /// The text. - /// The caption. - /// The button. - /// The icon. - /// MessageBoxResult. - public MessageBoxResult ShowModalMessage(string text, string caption = null, MessageBoxButton button = MessageBoxButton.OK, MessageBoxIcon icon = MessageBoxIcon.None) - { - var win = new ModalWindow - { - Caption = caption, - Button = button, - MessageBoxImage = icon, - Text = text - }; - - win.ShowModal(this); - - return win.MessageBoxResult; - } - - /// - /// Shows a modal message box and asynchronously returns a MessageBoxResult - /// - /// The text. - /// The caption. - /// The button. - /// The icon. - /// MessageBoxResult. - public MessageBoxResult ShowModalMessage(UIElement text, string caption = null, MessageBoxButton button = MessageBoxButton.OK, MessageBoxIcon icon = MessageBoxIcon.None) - { - var win = new ModalWindow - { - Caption = caption, - Button = button, - MessageBoxImage = icon, - TextContent = text - }; - - win.ShowModal(this); - - return win.MessageBoxResult; - } - } -} diff --git a/MediaBrowser.UI/MediaBrowser.UI.csproj b/MediaBrowser.UI/MediaBrowser.UI.csproj deleted file mode 100644 index 1f8469cbcd..0000000000 --- a/MediaBrowser.UI/MediaBrowser.UI.csproj +++ /dev/null @@ -1,1330 +0,0 @@ - - - - - Debug - AnyCPU - {B5ECE1FB-618E-420B-9A99-8E972D76920A} - WinExe - Properties - MediaBrowser.UI - MediaBrowser.UI - v4.5 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - ..\ - true - http://www.mb3admin.com/downloads/stdui/ - true - Web - false - Background - 7 - Days - false - false - true - http://forum.mediabrowser3.com - Media Browser Theater - Media Browser Team - Media Browser 3 - 2646 - 2.9.4795.2646 - false - true - true - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - Resources\Images\Icon.ico - - - 9633DCDB4A07D3328EFB99299C6DFB1823EBC4BE - - - MediaBrowser.UI_TemporaryKey.pfx - - - true - - - true - - - http://timestamp.verisign.com/scripts/timstamp.dll - - - x86 - bin\x86\Debug\ - - - x86 - bin\x86\Release\ - - - - true - - - - ..\ThirdParty\Taygeta\Declarations.dll - - - ..\ThirdParty\Taygeta\Implementation.dll - - - ..\ThirdParty\Taygeta\LibVlcWrapper.dll - - - ..\packages\MahApps.Metro.0.10.1.21-ALPHA\lib\net40\MahApps.Metro.dll - - - False - ..\ThirdParty\Expression\Microsoft.Expression.Effects.dll - - - False - ..\ThirdParty\Expression\Microsoft.Expression.Interactions.dll - - - ..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll - - - False - ..\packages\protobuf-net.2.0.0.621\lib\net40\protobuf-net.dll - - - ..\packages\SimpleInjector.2.0.0-beta5\lib\net40-client\SimpleInjector.dll - - - - - - - - - - ..\packages\MahApps.Metro.0.10.1.21-ALPHA\lib\net40\System.Windows.Interactivity.dll - - - - - - - - 4.0 - - - - - - - - - - - - - - NavigationBar.xaml - - - ModalWindow.xaml - - - NotificationMessage.xaml - - - - HiddenWindow.xaml - - - ImageViewerWindow.xaml - - - - - - - - - - - - - - - - WindowCommands.xaml - - - - - - - - - - - - - - - - - - - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - - - MainWindow.xaml - Code - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - - - - SettingsPage.xaml - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - Designer - - - - - {921c0f64-fda7-4e9f-9e73-0cb0eedb2422} - MediaBrowser.ApiInteraction - - - {cc96bf3e-0bda-4809-bc4b-bb6d418f4a84} - MediaBrowser.ClickOnce - - - {9142eefa-7570-41e1-bfcc-468bb571af2f} - MediaBrowser.Common - - - {5356ae30-6a6e-4a64-81e3-f76c50595e64} - MediaBrowser.IsoMounter - - - {67310740-0ec4-4dc2-9921-33df38b20167} - MediaBrowser.Logging.NLog - - - {7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b} - MediaBrowser.Model - - - {1adfe460-fd95-46fa-8871-cccb4b62e2e8} - MediaBrowser.UI.Controls - - - {e4be0659-4084-407b-b8a8-67802331cc9e} - MediaBrowser.UI.Uninstall - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - Microsoft .NET Framework 4.5 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - false - - - False - Visual C++ 2010 Runtime Libraries %28x86%29 - true - - - - - - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - - - - - - - - - - False - - - - - Include - True - Assembly - - - - - - xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i - - - \ No newline at end of file diff --git a/MediaBrowser.UI/MediaBrowser.UI_TemporaryKey.pfx b/MediaBrowser.UI/MediaBrowser.UI_TemporaryKey.pfx deleted file mode 100644 index 8a983ab8cd..0000000000 Binary files a/MediaBrowser.UI/MediaBrowser.UI_TemporaryKey.pfx and /dev/null differ diff --git a/MediaBrowser.UI/Pages/BaseDetailPage.cs b/MediaBrowser.UI/Pages/BaseDetailPage.cs deleted file mode 100644 index b7c54ce2ef..0000000000 --- a/MediaBrowser.UI/Pages/BaseDetailPage.cs +++ /dev/null @@ -1,159 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Net; -using MediaBrowser.UI.Controller; -using MediaBrowser.UI.Playback; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace MediaBrowser.UI.Pages -{ - /// - /// Provides a base class for detail pages - /// - public abstract class BaseDetailPage : BasePage - { - /// - /// The _item id - /// - private string _itemId; - /// - /// Gets or sets the id of the item being displayed - /// - /// The item id. - protected string ItemId - { - get { return _itemId; } - private set - { - _itemId = value; - OnPropertyChanged("ItemId"); - } - } - - /// - /// The _item - /// - private BaseItemDto _item; - /// - /// Gets or sets the item. - /// - /// The item. - public BaseItemDto Item - { - get { return _item; } - - set - { - _item = value; - OnPropertyChanged("Item"); - OnItemChanged(); - } - } - - /// - /// Gets a value indicating whether this instance can resume. - /// - /// true if this instance can resume; otherwise, false. - protected bool CanResume - { - get { return Item.CanResume; } - } - - /// - /// Gets a value indicating whether this instance can queue. - /// - /// true if this instance can queue; otherwise, false. - protected bool CanQueue - { - get { return true; } - } - - /// - /// Gets a value indicating whether this instance can play trailer. - /// - /// true if this instance can play trailer; otherwise, false. - protected bool CanPlayTrailer - { - get { return Item.HasTrailer; } - } - - /// - /// Initializes a new instance of the class. - /// - /// The item id. - protected BaseDetailPage(string itemId) - : base() - { - ItemId = itemId; - } - - /// - /// Called when [property changed]. - /// - /// The name. - public async override void OnPropertyChanged(string name) - { - base.OnPropertyChanged(name); - - // Reload the item when the itemId changes - if (name.Equals("ItemId")) - { - await ReloadItem(); - } - } - - /// - /// Reloads the item. - /// - /// Task. - private async Task ReloadItem() - { - try - { - Item = await App.Instance.ApiClient.GetItemAsync(ItemId, App.Instance.CurrentUser.Id); - } - catch (HttpException) - { - App.Instance.ShowDefaultErrorMessage(); - } - } - - /// - /// Called when [item changed]. - /// - protected virtual void OnItemChanged() - { - SetBackdrops(Item); - } - - /// - /// Plays this instance. - /// - public async void Play() - { - await UIKernel.Instance.PlaybackManager.Play(new PlayOptions - { - Items = new List { Item } - }); - } - - /// - /// Resumes this instance. - /// - public async void Resume() - { - await UIKernel.Instance.PlaybackManager.Play(new PlayOptions - { - Items = new List { Item }, - Resume = true - }); - } - - /// - /// Queues this instance. - /// - public void Queue() - { - } - } -} diff --git a/MediaBrowser.UI/Pages/BaseFolderPage.cs b/MediaBrowser.UI/Pages/BaseFolderPage.cs deleted file mode 100644 index 52bddcd90e..0000000000 --- a/MediaBrowser.UI/Pages/BaseFolderPage.cs +++ /dev/null @@ -1,502 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Net; -using MediaBrowser.UI.ViewModels; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Controls; - -namespace MediaBrowser.UI.Pages -{ - /// - /// Provides a base class for pages based on a folder item (list, home) - /// - public abstract class BaseFolderPage : BasePage - { - /// - /// Initializes a new instance of the class. - /// - /// The item id. - protected BaseFolderPage(string itemId) - : base() - { - ItemId = itemId; - } - - /// - /// The _item id - /// - private string _itemId; - /// - /// Gets or sets the Id of the item being displayed - /// - /// The item id. - protected string ItemId - { - get { return _itemId; } - private set - { - _itemId = value; - OnPropertyChanged("ItemId"); - } - } - - /// - /// The _index by - /// - private string _indexBy; - /// - /// Gets or sets the name of the current index function - /// - /// The index by. - public string IndexBy - { - get { return _indexBy; } - private set - { - _indexBy = value; - OnPropertyChanged("IndexBy"); - } - } - - /// - /// The _sort by - /// - private string _sortBy; - /// - /// Gets or sets the name of the current sort function - /// - /// The sort by. - public string SortBy - { - get { return _sortBy; } - private set - { - _sortBy = value; - OnPropertyChanged("SortBy"); - } - } - - /// - /// The _folder - /// - private BaseItemDto _folder; - /// - /// Gets or sets the Folder being displayed - /// - /// The folder. - public BaseItemDto Folder - { - get { return _folder; } - - set - { - _folder = value; - OnPropertyChanged("Folder"); - OnFolderChanged(); - ReloadChildren(); - } - } - - /// - /// If wrap panels are being used this will get the orientation that should be used, based on scroll direction - /// - /// The wrap panel orientation. - public Orientation WrapPanelOrientation - { - get - { - return DisplayPreferences.ScrollDirection == ScrollDirection.Horizontal ? Orientation.Vertical : Orientation.Horizontal; - } - } - - /// - /// The _display preferences - /// - private DisplayPreferences _displayPreferences; - /// - /// Gets of sets the current DisplayPreferences - /// - /// The display preferences. - public DisplayPreferences DisplayPreferences - { - get { return _displayPreferences; } - - private set - { - _displayPreferences = value; - - // If the page is using it's own image type and not honoring the DisplayPreferences setting, set it now - if (_displayPreferences != null && FixedImageType.HasValue) - { - _displayPreferences.PrimaryImageType = FixedImageType.Value; - } - - NotifyDisplayPreferencesChanged(); - } - } - - /// - /// The _children - /// - private ItemsResult _children; - /// - /// Gets or sets the children of the Folder being displayed - /// - /// The children. - public ItemsResult Children - { - get { return _children; } - - private set - { - _children = value; - OnPropertyChanged("Children"); - ChildCount = _children.TotalRecordCount; - OnChildrenChanged(); - - DisplayChildren = DtoBaseItemViewModel.GetObservableItems(Children.Items, AveragePrimaryImageAspectRatio, DisplayPreferences); - } - } - - /// - /// The _display children - /// - private ObservableCollection _displayChildren; - /// - /// Gets the actual children that should be displayed. - /// Subclasses should bind to this, not Children. - /// - /// The display children. - public ObservableCollection DisplayChildren - { - get { return _displayChildren; } - - private set - { - _displayChildren = value; - OnPropertyChanged("DisplayChildren"); - } - } - - /// - /// The _child count - /// - private int _childCount; - /// - /// Gets or sets the number of children within the Folder - /// - /// The child count. - public int ChildCount - { - get { return _childCount; } - - private set - { - _childCount = value; - OnPropertyChanged("ChildCount"); - } - } - - /// - /// If the page is using it's own image type and not honoring the DisplayPreferences setting, it should return it here - /// - /// The type of the fixed image. - protected virtual ImageType? FixedImageType - { - get { return null; } - } - - /// - /// The _average primary image aspect ratio - /// - private double _averagePrimaryImageAspectRatio; - /// - /// Gets or sets the average primary image aspect ratio for all items - /// - /// The average primary image aspect ratio. - public double AveragePrimaryImageAspectRatio - { - get { return _averagePrimaryImageAspectRatio; } - - private set - { - _averagePrimaryImageAspectRatio = value; - OnPropertyChanged("AveragePrimaryImageAspectRatio"); - } - } - - /// - /// Gets the aspect ratio that should be used based on a given ImageType - /// - /// Type of the image. - /// System.Double. - public double GetAspectRatio(ImageType imageType) - { - return GetAspectRatio(imageType, AveragePrimaryImageAspectRatio); - } - - /// - /// Gets the aspect ratio that should be used based on a given ImageType - /// - /// Type of the image. - /// The average primary image aspect ratio. - /// System.Double. - public static double GetAspectRatio(ImageType imageType, double averagePrimaryImageAspectRatio) - { - switch (imageType) - { - case ImageType.Art: - return 1.777777777777778; - case ImageType.Backdrop: - return 1.777777777777778; - case ImageType.Banner: - return 5.414285714285714; - case ImageType.Disc: - return 1; - case ImageType.Logo: - return 1.777777777777778; - case ImageType.Primary: - return averagePrimaryImageAspectRatio; - case ImageType.Thumb: - return 1.777777777777778; - default: - return 1; - } - } - - /// - /// Called when [property changed]. - /// - /// The name. - public async override void OnPropertyChanged(string name) - { - base.OnPropertyChanged(name); - - // Reload the Folder when the itemId changes - if (name.Equals("ItemId")) - { - await ReloadFolder(); - } - } - - /// - /// Reloads the folder - /// - /// Task. - private async Task ReloadFolder() - { - try - { - if (string.IsNullOrEmpty(ItemId)) - { - Folder = await App.Instance.ApiClient.GetRootFolderAsync(App.Instance.CurrentUser.Id); - } - else - { - Folder = await App.Instance.ApiClient.GetItemAsync(ItemId, App.Instance.CurrentUser.Id); - } - } - catch (HttpException) - { - App.Instance.ShowDefaultErrorMessage(); - } - } - - /// - /// Gets called anytime the Folder gets refreshed - /// - protected virtual void OnFolderChanged() - { - SetBackdrops(Folder); - - DisplayPreferences = Folder.DisplayPreferences; - - if (DisplayPreferences.RememberIndexing) - { - IndexBy = DisplayPreferences.IndexBy; - } - - if (DisplayPreferences.RememberSorting) - { - SortBy = DisplayPreferences.SortBy ?? Folder.SortOptions.FirstOrDefault(); - } - else if (string.IsNullOrEmpty(SortBy)) - { - SortBy = Folder.SortOptions.FirstOrDefault(); - } - } - - /// - /// Gets called anytime the Children get refreshed - /// - protected virtual void OnChildrenChanged() - { - AveragePrimaryImageAspectRatio = DtoBaseItemViewModel.GetAveragePrimaryImageAspectRatio(Children.Items); - - if (DisplayPreferences != null) - { - DisplayPreferences.PrimaryImageWidth = Convert.ToInt32(DisplayPreferences.PrimaryImageHeight * GetAspectRatio(DisplayPreferences.PrimaryImageType)); - } - - NotifyDisplayPreferencesChanged(); - } - - /// - /// Reloads the Folder's children - /// - /// Task. - public async Task ReloadChildren() - { - var query = new ItemQuery - { - ParentId = Folder.Id, - - Fields = new[] { - ItemFields.UserData, - ItemFields.PrimaryImageAspectRatio - }, - - UserId = App.Instance.CurrentUser.Id, - - IndexBy = IndexBy, - - DynamicSortBy = SortBy - }; - - try - { - Children = await App.Instance.ApiClient.GetItemsAsync(query); - } - catch (HttpException) - { - App.Instance.ShowDefaultErrorMessage(); - } - } - - /// - /// Gets called anytime a DisplayPreferences property is updated - /// - public virtual void NotifyDisplayPreferencesChanged() - { - OnPropertyChanged("DisplayPreferences"); - - if (DisplayChildren != null) - { - // Notify all of the child view models - foreach (var child in DisplayChildren) - { - child.AveragePrimaryImageAspectRatio = AveragePrimaryImageAspectRatio; - child.NotifyDisplayPreferencesChanged(); - } - } - - OnPropertyChanged("WrapPanelOrientation"); - } - - /// - /// Changes the sort option on the page - /// - /// The option. - /// Task. - public async Task UpdateSortOption(string option) - { - var tasks = new List(); - - SortBy = option; - - if (DisplayPreferences.RememberSorting) - { - DisplayPreferences.SortBy = option; - NotifyDisplayPreferencesChanged(); - - tasks.Add(Task.Run(async () => - { - try - { - await App.Instance.ApiClient.UpdateDisplayPreferencesAsync(App.Instance.CurrentUser.Id, Folder.Id, DisplayPreferences); - } - catch - { - App.Instance.ShowDefaultErrorMessage(); - } - })); - } - - tasks.Add(ReloadChildren()); - - await Task.WhenAll(tasks); - } - - /// - /// Changes the index option on the page - /// - /// The option. - /// Task. - public async Task UpdateIndexOption(string option) - { - var tasks = new List(); - - IndexBy = option; - - if (DisplayPreferences.RememberIndexing) - { - DisplayPreferences.IndexBy = option; - NotifyDisplayPreferencesChanged(); - - tasks.Add(Task.Run(async () => - { - try - { - await App.Instance.ApiClient.UpdateDisplayPreferencesAsync(App.Instance.CurrentUser.Id, Folder.Id, DisplayPreferences); - } - catch - { - App.Instance.ShowDefaultErrorMessage(); - } - })); - } - - tasks.Add(ReloadChildren()); - - await Task.WhenAll(tasks); - } - - /// - /// Updates the index of the remember. - /// - /// if set to true [remember]. - /// Task. - public async Task UpdateRememberIndex(bool remember) - { - DisplayPreferences.RememberIndexing = remember; - - if (remember) - { - DisplayPreferences.IndexBy = IndexBy; - } - - await App.Instance.ApiClient.UpdateDisplayPreferencesAsync(App.Instance.CurrentUser.Id, Folder.Id, DisplayPreferences); - } - - /// - /// Updates the remember sort. - /// - /// if set to true [remember]. - /// Task. - public async Task UpdateRememberSort(bool remember) - { - DisplayPreferences.RememberSorting = remember; - - if (remember) - { - DisplayPreferences.SortBy = SortBy; - } - - await App.Instance.ApiClient.UpdateDisplayPreferencesAsync(App.Instance.CurrentUser.Id, Folder.Id, DisplayPreferences); - } - } -} diff --git a/MediaBrowser.UI/Pages/BaseHomePage.cs b/MediaBrowser.UI/Pages/BaseHomePage.cs deleted file mode 100644 index 6fb41b966a..0000000000 --- a/MediaBrowser.UI/Pages/BaseHomePage.cs +++ /dev/null @@ -1,17 +0,0 @@ - -namespace MediaBrowser.UI.Pages -{ - public abstract class BaseHomePage : BaseFolderPage - { - protected BaseHomePage() - : base(string.Empty) - { - } - - protected override void OnLoaded() - { - base.OnLoaded(); - ClearBackdrops(); - } - } -} diff --git a/MediaBrowser.UI/Pages/BaseInternalPlayerPage.cs b/MediaBrowser.UI/Pages/BaseInternalPlayerPage.cs deleted file mode 100644 index 3d651c4fa9..0000000000 --- a/MediaBrowser.UI/Pages/BaseInternalPlayerPage.cs +++ /dev/null @@ -1,49 +0,0 @@ -using MediaBrowser.UI.Controller; -using MediaBrowser.UI.Playback; -using System.Windows; - -namespace MediaBrowser.UI.Pages -{ - /// - /// Class BaseInternalPlayerPage - /// - public abstract class BaseInternalPlayerPage : BasePage - { - /// - /// Called when [loaded]. - /// - protected override void OnLoaded() - { - base.OnLoaded(); - - App.Instance.ApplicationWindow.WindowBackgroundContent.Visibility = Visibility.Collapsed; - App.Instance.ApplicationWindow.PageContent.Visibility = Visibility.Collapsed; - - UIKernel.Instance.PlaybackManager.PlaybackCompleted -= PlaybackManager_PlaybackCompleted; - UIKernel.Instance.PlaybackManager.PlaybackCompleted += PlaybackManager_PlaybackCompleted; - } - - /// - /// Handles the PlaybackCompleted event of the PlaybackManager control. - /// - /// The source of the event. - /// The instance containing the event data. - void PlaybackManager_PlaybackCompleted(object sender, PlaybackStopEventArgs e) - { - App.Instance.ApplicationWindow.NavigateBack(); - } - - /// - /// Called when [unloaded]. - /// - protected override void OnUnloaded() - { - UIKernel.Instance.PlaybackManager.PlaybackCompleted -= PlaybackManager_PlaybackCompleted; - - base.OnUnloaded(); - - App.Instance.ApplicationWindow.PageContent.Visibility = Visibility.Visible; - App.Instance.ApplicationWindow.WindowBackgroundContent.Visibility = Visibility.Visible; - } - } -} diff --git a/MediaBrowser.UI/Pages/BaseListPage.cs b/MediaBrowser.UI/Pages/BaseListPage.cs deleted file mode 100644 index 5196e2b32f..0000000000 --- a/MediaBrowser.UI/Pages/BaseListPage.cs +++ /dev/null @@ -1,204 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.UI.Controls; -using MediaBrowser.UI.ViewModels; -using System; -using System.Threading; -using System.Windows.Controls; - -namespace MediaBrowser.UI.Pages -{ - /// - /// Provides a base page for all list pages - /// - public abstract class BaseListPage : BaseFolderPage - { - /// - /// Gets or sets the current selection timer. - /// - /// The current selection timer. - private Timer CurrentSelectionTimer { get; set; } - - /// - /// Subclasses must provide the list box that holds the items - /// - /// The items list. - protected abstract ExtendedListBox ItemsList { get; } - - /// - /// Initializes a new instance of the class. - /// - /// The item id. - protected BaseListPage(string itemId) - : base(itemId) - { - } - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void OnInitialized(EventArgs e) - { - base.OnInitialized(e); - - ItemsList.SelectionChanged += ItemsList_SelectionChanged; - ItemsList.ItemInvoked += ItemsList_ItemInvoked; - } - - /// - /// The _current item - /// - private BaseItemDto _currentItem; - /// - /// Gets or sets the current selected item - /// - /// The current item. - public BaseItemDto CurrentItem - { - get { return _currentItem; } - - set - { - _currentItem = value; - - // Update the current item index immediately - UpdateCurrentItemIndex(value); - - // Fire notification events after a short delay - // We don't want backdrops and logos reloading while the user is navigating quickly - if (CurrentSelectionTimer != null) - { - CurrentSelectionTimer.Change(500, Timeout.Infinite); - } - else - { - CurrentSelectionTimer = new Timer(CurrentItemChangedTimerCallback, value, 500, Timeout.Infinite); - } - } - } - - /// - /// Fires when the current item selection timer expires - /// - /// The state. - private void CurrentItemChangedTimerCallback(object state) - { - Dispatcher.InvokeAsync(() => - { - // Fire notification events for the UI - OnPropertyChanged("CurrentItem"); - - // Alert subclasses - OnCurrentItemChanged(); - }); - - // Dispose the timer - CurrentSelectionTimer.Dispose(); - CurrentSelectionTimer = null; - } - - /// - /// Updates the current item index based on the current selection - /// - /// The value. - private void UpdateCurrentItemIndex(BaseItemDto value) - { - if (value == null) - { - CurrentItemIndex = -1; - } - else - { - CurrentItemIndex = ItemsList.SelectedIndex; - } - } - - /// - /// The _current item index - /// - private int _currentItemIndex; - /// - /// Gets of sets the index of the current item being displayed - /// - /// The index of the current item. - public int CurrentItemIndex - { - get { return _currentItemIndex; } - - set - { - _currentItemIndex = value; - OnPropertyChanged("CurrentItemIndex"); - } - } - - /// - /// Handles the list selection changed event to update the current item - /// - /// The source of the event. - /// The instance containing the event data. - void ItemsList_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - if (e.AddedItems.Count > 0) - { - CurrentItem = (e.AddedItems[0] as DtoBaseItemViewModel).Item; - } - else - { - CurrentItem = null; - } - } - - /// - /// Itemses the list_ item invoked. - /// - /// The sender. - /// The e. - /// - void ItemsList_ItemInvoked(object sender, ItemEventArgs e) - { - var model = e.Argument as DtoBaseItemViewModel; - - if (model != null) - { - App.Instance.NavigateToItem(model.Item); - } - } - - /// - /// Handles current item selection changes - /// - protected virtual void OnCurrentItemChanged() - { - if (CurrentItem != null) - { - SetBackdrops(CurrentItem); - } - } - - /// - /// Gets called anytime a DisplayPreferences property is updated - /// - public override void NotifyDisplayPreferencesChanged() - { - base.NotifyDisplayPreferencesChanged(); - - // Make sure the items list has been initialized - if (ItemsList != null) - { - if (DisplayPreferences.ScrollDirection == ScrollDirection.Horizontal) - { - ScrollViewer.SetHorizontalScrollBarVisibility(ItemsList, ScrollBarVisibility.Hidden); - ScrollViewer.SetVerticalScrollBarVisibility(ItemsList, ScrollBarVisibility.Disabled); - } - else - { - ScrollViewer.SetHorizontalScrollBarVisibility(ItemsList, ScrollBarVisibility.Disabled); - ScrollViewer.SetVerticalScrollBarVisibility(ItemsList, ScrollBarVisibility.Hidden); - } - } - } - - } -} diff --git a/MediaBrowser.UI/Pages/BaseLoginPage.cs b/MediaBrowser.UI/Pages/BaseLoginPage.cs deleted file mode 100644 index cc8f96427a..0000000000 --- a/MediaBrowser.UI/Pages/BaseLoginPage.cs +++ /dev/null @@ -1,119 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Net; -using MediaBrowser.UI.Controls; -using System; -using System.Threading.Tasks; - -namespace MediaBrowser.UI.Pages -{ - /// - /// Provides a base page for theme login pages - /// - public abstract class BaseLoginPage : BasePage - { - /// - /// The _users - /// - private UserDto[] _users; - /// - /// Gets or sets the users. - /// - /// The users. - public UserDto[] Users - { - get { return _users; } - - set - { - _users = value; - OnPropertyChanged("Users"); - } - } - - /// - /// Subclasses must provide the list that holds the users - /// - /// The items list. - protected abstract ExtendedListBox ItemsList { get; } - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override async void OnInitialized(EventArgs e) - { - base.OnInitialized(e); - - ItemsList.ItemInvoked += ItemsList_ItemInvoked; - - try - { - Users = await App.Instance.ApiClient.GetAllUsersAsync(); - } - catch (HttpException) - { - App.Instance.ShowErrorMessage("There was an error retrieving the list of users from the server."); - } - } - - /// - /// Called when [loaded]. - /// - protected override void OnLoaded() - { - base.OnLoaded(); - ClearBackdrops(); - } - - /// - /// Logs in a user when one is selected - /// - /// The sender. - /// The e. - async void ItemsList_ItemInvoked(object sender, ItemEventArgs e) - { - var user = (UserDto)e.Argument; - - try - { - await LoginUser(user); - } - catch (HttpException ex) - { - if (ex.StatusCode.HasValue && ex.StatusCode.Value == System.Net.HttpStatusCode.Unauthorized) - { - App.Instance.ShowErrorMessage("Invalid username or password. Please try again.", caption: "Login Failure"); - } - else - { - App.Instance.ShowDefaultErrorMessage(); - } - } - } - - /// - /// Logs in a user and verifies their password - /// - /// The user. - /// The password. - /// Task{AuthenticationResult}. - protected async Task LoginUser(UserDto user, string password) - { - await App.Instance.ApiClient.AuthenticateUserAsync(user.Id, password); - - App.Instance.CurrentUser = user; - - App.Instance.NavigateToHomePage(); - } - - /// - /// Logs in a user who does not have a password - /// - /// The user. - /// Task{AuthenticationResult}. - protected Task LoginUser(UserDto user) - { - return LoginUser(user, null); - } - } -} diff --git a/MediaBrowser.UI/Pages/BasePage.cs b/MediaBrowser.UI/Pages/BasePage.cs deleted file mode 100644 index 667a29ff37..0000000000 --- a/MediaBrowser.UI/Pages/BasePage.cs +++ /dev/null @@ -1,71 +0,0 @@ -using MediaBrowser.Model.Dto; -using System; -using System.ComponentModel; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; - -namespace MediaBrowser.UI.Pages -{ - /// - /// Provides a common base page for all pages - /// - public abstract class BasePage : Page, INotifyPropertyChanged - { - public event PropertyChangedEventHandler PropertyChanged; - - public virtual void OnPropertyChanged(string name) - { - if (PropertyChanged != null) - { - PropertyChanged(this, new PropertyChangedEventArgs(name)); - } - } - - protected override void OnInitialized(EventArgs e) - { - Loaded += BasePageLoaded; - Unloaded += BasePage_Unloaded; - - base.OnInitialized(e); - - DataContext = this; - } - - void BasePage_Unloaded(object sender, RoutedEventArgs e) - { - OnUnloaded(); - } - - void BasePageLoaded(object sender, RoutedEventArgs e) - { - OnLoaded(); - } - - protected virtual void OnLoaded() - { - // Give focus to the first element - MoveFocus(new TraversalRequest(FocusNavigationDirection.First)); - } - - protected virtual void OnUnloaded() - { - } - - /// - /// Sets the backdrop based on a BaseItemDto - /// - public void SetBackdrops(BaseItemDto item) - { - App.Instance.ApplicationWindow.SetBackdrops(item); - } - - /// - /// Clears current backdrops - /// - public void ClearBackdrops() - { - App.Instance.ApplicationWindow.ClearBackdrops(); - } - } -} diff --git a/MediaBrowser.UI/Pages/BaseWeatherPage.cs b/MediaBrowser.UI/Pages/BaseWeatherPage.cs deleted file mode 100644 index 6497967de2..0000000000 --- a/MediaBrowser.UI/Pages/BaseWeatherPage.cs +++ /dev/null @@ -1,7 +0,0 @@ - -namespace MediaBrowser.UI.Pages -{ - public class BaseWeatherPage : BasePage - { - } -} diff --git a/MediaBrowser.UI/Pages/SettingsPage.xaml b/MediaBrowser.UI/Pages/SettingsPage.xaml deleted file mode 100644 index 27b4383515..0000000000 --- a/MediaBrowser.UI/Pages/SettingsPage.xaml +++ /dev/null @@ -1,16 +0,0 @@ - - - - Settings Page - - - - diff --git a/MediaBrowser.UI/Pages/SettingsPage.xaml.cs b/MediaBrowser.UI/Pages/SettingsPage.xaml.cs deleted file mode 100644 index db273bbe5a..0000000000 --- a/MediaBrowser.UI/Pages/SettingsPage.xaml.cs +++ /dev/null @@ -1,14 +0,0 @@ - -namespace MediaBrowser.UI.Pages -{ - /// - /// Interaction logic for SettingsPage.xaml - /// - public partial class SettingsPage : BasePage - { - public SettingsPage() - { - InitializeComponent(); - } - } -} diff --git a/MediaBrowser.UI/Playback/BaseMediaPlayer.cs b/MediaBrowser.UI/Playback/BaseMediaPlayer.cs deleted file mode 100644 index 6e3324b053..0000000000 --- a/MediaBrowser.UI/Playback/BaseMediaPlayer.cs +++ /dev/null @@ -1,747 +0,0 @@ -using MediaBrowser.Common.Events; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Logging; -using MediaBrowser.Model.Net; -using MediaBrowser.UI.Configuration; -using MediaBrowser.UI.Controller; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.UI.Playback -{ - /// - /// Class BaseMediaPlayer - /// - public abstract class BaseMediaPlayer : IDisposable - { - /// - /// Gets the logger. - /// - /// The logger. - protected ILogger Logger { get; private set; } - - #region VolumeChanged - /// - /// Occurs when [volume changed]. - /// - public event EventHandler VolumeChanged; - protected void OnVolumeChanged() - { - EventHelper.FireEventIfNotNull(VolumeChanged, this, EventArgs.Empty, Logger); - } - #endregion - - #region PlayStateChanged - /// - /// Occurs when [play state changed]. - /// - public event EventHandler PlayStateChanged; - protected void OnPlayStateChanged() - { - EventHelper.FireEventIfNotNull(PlayStateChanged, this, EventArgs.Empty, Logger); - } - #endregion - - /// - /// The null task result - /// - protected Task NullTaskResult = Task.FromResult(false); - - /// - /// Gets a value indicating whether [supports multi file playback]. - /// - /// true if [supports multi file playback]; otherwise, false. - public abstract bool SupportsMultiFilePlayback { get; } - - /// - /// The currently playing items - /// - public List Playlist = new List(); - - /// - /// The _play state - /// - private PlayState _playState; - /// - /// Gets or sets the state of the play. - /// - /// The state of the play. - public PlayState PlayState - { - get - { - return _playState; - } - set - { - _playState = value; - - OnPlayStateChanged(); - } - } - - /// - /// Gets or sets a value indicating whether this is mute. - /// - /// true if mute; otherwise, false. - public bool Mute - { - get { return IsMuted; } - set - { - SetMute(value); - OnVolumeChanged(); - } - } - - /// - /// Gets or sets the volume. - /// - /// The volume. - public int Volume - { - get { return GetVolume(); } - set - { - SetVolume(value); - OnVolumeChanged(); - } - } - - /// - /// Gets the current player configuration. - /// - /// The current player configuration. - public PlayerConfiguration CurrentPlayerConfiguration { get; private set; } - - /// - /// Gets the current play options. - /// - /// The current play options. - public PlayOptions CurrentPlayOptions { get; private set; } - - /// - /// Gets the name. - /// - /// The name. - public abstract string Name { get; } - - /// - /// Determines whether this instance can play the specified item. - /// - /// The item. - /// true if this instance can play the specified item; otherwise, false. - public abstract bool CanPlay(BaseItemDto item); - - /// - /// Gets a value indicating whether this instance can change volume. - /// - /// true if this instance can change volume; otherwise, false. - public abstract bool CanControlVolume { get; } - - /// - /// Gets a value indicating whether this instance can mute. - /// - /// true if this instance can mute; otherwise, false. - public abstract bool CanMute { get; } - - /// - /// Gets a value indicating whether this instance can queue. - /// - /// true if this instance can queue; otherwise, false. - public abstract bool CanQueue { get; } - - /// - /// Gets a value indicating whether this instance can pause. - /// - /// true if this instance can pause; otherwise, false. - public abstract bool CanPause { get; } - - /// - /// Gets a value indicating whether this instance can seek. - /// - /// true if this instance can seek; otherwise, false. - public abstract bool CanSeek { get; } - - /// - /// Gets the index of the current playlist. - /// - /// The index of the current playlist. - public virtual int CurrentPlaylistIndex - { - get { return 0; } - } - - /// - /// Gets the current media. - /// - /// The current media. - public BaseItemDto CurrentMedia - { - get - { - return CurrentPlaylistIndex == -1 ? null : Playlist[CurrentPlaylistIndex]; - } - } - - /// - /// Gets the current position ticks. - /// - /// The current position ticks. - public virtual long? CurrentPositionTicks - { - get - { - return null; - } - } - - /// - /// Gets a value indicating whether this instance is muted. - /// - /// true if this instance is muted; otherwise, false. - protected virtual bool IsMuted - { - get { return false; } - } - - /// - /// Initializes a new instance of the class. - /// - protected BaseMediaPlayer(ILogger logger) - { - Logger = logger; - } - - /// - /// Sets the mute. - /// - /// if set to true [mute]. - protected virtual void SetMute(bool mute) - { - } - - /// - /// Sets the volume, on a scale from 0-100 - /// - /// The value. - protected virtual void SetVolume(int value) - { - } - - /// - /// Gets the volume. - /// - /// System.Int32. - protected virtual int GetVolume() - { - return 0; - } - - /// - /// Plays the internal. - /// - /// The items. - /// The options. - /// The player configuration. - protected abstract void PlayInternal(List items, PlayOptions options, PlayerConfiguration playerConfiguration); - - /// - /// Queues the internal. - /// - /// The items. - protected virtual void QueueInternal(List items) - { - } - - /// - /// Stops the internal. - /// - /// Task. - protected abstract Task StopInternal(); - - /// - /// The play semaphore - /// - private readonly SemaphoreSlim PlaySemaphore = new SemaphoreSlim(1, 1); - - /// - /// Gets or sets the progress update timer. - /// - /// The progress update timer. - private Timer ProgressUpdateTimer { get; set; } - - /// - /// Gets a value indicating whether this instance can monitor progress. - /// - /// true if this instance can monitor progress; otherwise, false. - protected virtual bool CanMonitorProgress - { - get - { - return false; - } - } - - /// - /// Stops this instance. - /// - /// Task. - /// - public Task Stop() - { - var playstate = PlayState; - - if (playstate == PlayState.Playing || playstate == PlayState.Paused) - { - Logger.Info("Stopping"); - - return StopInternal(); - } - - throw new InvalidOperationException(string.Format("{0} is already {1}", Name, playstate)); - } - - /// - /// Plays the specified item. - /// - /// The options. - /// The player configuration. - /// Task. - /// items - internal async Task Play(PlayOptions options, PlayerConfiguration playerConfiguration) - { - if (options == null) - { - throw new ArgumentNullException("options"); - } - - await PlaySemaphore.WaitAsync(); - - PlayState = PlayState.Playing; - - lock (Playlist) - { - Playlist.Clear(); - Playlist.AddRange(options.Items); - } - - CurrentPlayerConfiguration = playerConfiguration; - CurrentPlayOptions = options; - - if (options.Items.Count > 1) - { - Logger.Info("Playing {0} items", options.Items.Count); - } - else - { - Logger.Info("Playing {0}", options.Items[0].Name); - } - - try - { - PlayInternal(options.Items, options, playerConfiguration); - } - catch (Exception ex) - { - Logger.Info("Error beginning playback", ex); - - CurrentPlayerConfiguration = null; - CurrentPlayOptions = null; - Playlist.Clear(); - - PlayState = PlayState.Idle; - PlaySemaphore.Release(); - - throw; - } - - SendPlaybackStartCheckIn(options.Items[0]); - - ReloadProgressUpdateTimer(); - } - - /// - /// Restarts the progress update timer. - /// - private void ReloadProgressUpdateTimer() - { - ProgressUpdateTimer = new Timer(OnProgressTimerStopped, null, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10)); - } - - /// - /// Called when [progress timer stopped]. - /// - /// The state. - private void OnProgressTimerStopped(object state) - { - var index = CurrentPlaylistIndex; - - if (index != -1) - { - SendPlaybackProgressCheckIn(Playlist[index], CurrentPositionTicks); - } - } - - /// - /// Queues the specified items. - /// - /// The items. - /// items - /// - internal void Queue(List items) - { - if (items == null) - { - throw new ArgumentNullException("items"); - } - - var playstate = PlayState; - - if (playstate != PlayState.Playing && playstate != PlayState.Paused) - { - throw new InvalidOperationException(string.Format("{0} cannot queue from playstate: {1}", Name, playstate)); - } - - lock (Playlist) - { - Playlist.AddRange(items); - } - - QueueInternal(items); - } - - /// - /// Called when [player stopped]. - /// - /// Last index of the playlist. - /// The position ticks. - protected void OnPlayerStopped(int? lastPlaylistIndex, long? positionTicks) - { - Logger.Info("Stopped"); - - if (positionTicks.HasValue && positionTicks.Value == 0) - { - positionTicks = null; - } - - var items = Playlist.ToList(); - - DisposeProgressUpdateTimer(); - - var index = lastPlaylistIndex ?? CurrentPlaylistIndex; - - var lastItem = items[index]; - SendPlaybackStopCheckIn(items[index], positionTicks); - - if (!CanMonitorProgress) - { - if (items.Count > 1) - { - MarkWatched(items.Except(new[] { lastItem })); - } - } - - OnPlayerStoppedInternal(); - - UIKernel.Instance.PlaybackManager.OnPlaybackCompleted(this, Playlist.ToList()); - - CurrentPlayerConfiguration = null; - CurrentPlayOptions = null; - Logger.Info("Clearing Playlist"); - Playlist.Clear(); - - PlayState = PlayState.Idle; - - PlaySemaphore.Release(); - } - - /// - /// Called when [player stopped internal]. - /// - protected virtual void OnPlayerStoppedInternal() - { - - } - - /// - /// Seeks the specified position ticks. - /// - /// The position ticks. - /// Task. - /// - public async Task Seek(long positionTicks) - { - var playState = PlayState; - - if (playState == PlayState.Playing || playState == PlayState.Paused) - { - await SeekInternal(positionTicks); - } - else - { - throw new InvalidOperationException(string.Format("Cannot seek {0} with playstate {1}", Name, PlayState)); - } - } - - /// - /// Seeks the internal. - /// - /// The position ticks. - /// Task. - protected virtual Task SeekInternal(long positionTicks) - { - return NullTaskResult; - } - - /// - /// The ten seconds - /// - private static readonly long TenSeconds = TimeSpan.FromSeconds(10).Ticks; - - /// - /// Goes to next chapter. - /// - /// Task. - public virtual Task GoToNextChapter() - { - var current = CurrentPositionTicks; - - var chapter = CurrentMedia.Chapters.FirstOrDefault(c => c.StartPositionTicks > current); - - return chapter != null ? Seek(chapter.StartPositionTicks) : NullTaskResult; - } - - /// - /// Goes to previous chapter. - /// - /// Task. - public virtual Task GoToPreviousChapter() - { - var current = CurrentPositionTicks; - - var chapter = CurrentMedia.Chapters.LastOrDefault(c => c.StartPositionTicks < current - TenSeconds); - - return chapter != null ? Seek(chapter.StartPositionTicks) : NullTaskResult; - } - - /// - /// Pauses this instance. - /// - /// Task. - /// - public async Task Pause() - { - if (PlayState == PlayState.Playing) - { - await PauseInternal(); - - PlayState = PlayState.Paused; - } - else - { - throw new InvalidOperationException(string.Format("Cannot pause {0} with playstate {1}", Name, PlayState)); - } - } - - /// - /// Pauses the internal. - /// - /// Task. - protected virtual Task PauseInternal() - { - return NullTaskResult; - } - - /// - /// Uns the pause. - /// - /// Task. - /// - public async Task UnPause() - { - if (PlayState == PlayState.Paused) - { - await UnPauseInternal(); - PlayState = PlayState.Playing; - } - else - { - throw new InvalidOperationException(string.Format("Cannot unpause {0} with playstate {1}", Name, PlayState)); - } - } - - /// - /// Uns the pause internal. - /// - /// Task. - protected virtual Task UnPauseInternal() - { - return NullTaskResult; - } - - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - Dispose(true); - } - - /// - /// Releases unmanaged and - optionally - managed resources. - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected virtual void Dispose(bool dispose) - { - Logger.Info("Disposing"); - - DisposeProgressUpdateTimer(); - - if (PlayState == PlayState.Playing || PlayState == PlayState.Paused) - { - var index = CurrentPlaylistIndex; - - if (index != -1) - { - SendPlaybackStopCheckIn(Playlist[index], CurrentPositionTicks); - } - Task.Run(() => Stop()); - Thread.Sleep(1000); - } - - PlaySemaphore.Dispose(); - } - - /// - /// Disposes the progress update timer. - /// - private void DisposeProgressUpdateTimer() - { - if (ProgressUpdateTimer != null) - { - ProgressUpdateTimer.Dispose(); - } - } - - /// - /// Sends the playback start check in. - /// - /// The item. - protected async void SendPlaybackStartCheckIn(BaseItemDto item) - { - if (string.IsNullOrEmpty(item.Id)) - { - return; - } - - Logger.Info("Sending playback start checkin for {0}", item.Name); - - try - { - await UIKernel.Instance.ApiClient.ReportPlaybackStartAsync(item.Id, App.Instance.CurrentUser.Id); - } - catch (HttpException ex) - { - Logger.ErrorException("Error sending playback start checking for {0}", ex, item.Name); - } - } - - /// - /// Sends the playback progress check in. - /// - /// The item. - /// The position ticks. - protected async void SendPlaybackProgressCheckIn(BaseItemDto item, long? positionTicks) - { - if (string.IsNullOrEmpty(item.Id)) - { - return; - } - var position = positionTicks.HasValue ? TimeSpan.FromTicks(positionTicks.Value).ToString() : "unknown"; - - Logger.Info("Sending playback progress checkin for {0} at position {1}", item.Name, position); - - try - { - await UIKernel.Instance.ApiClient.ReportPlaybackProgressAsync(item.Id, App.Instance.CurrentUser.Id, positionTicks); - } - catch (HttpException ex) - { - Logger.ErrorException("Error sending playback progress checking for {0}", ex, item.Name); - } - } - - /// - /// Sends the playback stop check in. - /// - /// The item. - /// The position ticks. - protected async void SendPlaybackStopCheckIn(BaseItemDto item, long? positionTicks) - { - if (string.IsNullOrEmpty(item.Id)) - { - return; - } - var position = positionTicks.HasValue ? TimeSpan.FromTicks(positionTicks.Value).ToString() : "unknown"; - - Logger.Info("Sending playback stop checkin for {0} at position {1}", item.Name, position); - - try - { - await UIKernel.Instance.ApiClient.ReportPlaybackStoppedAsync(item.Id, App.Instance.CurrentUser.Id, positionTicks); - } - catch (HttpException ex) - { - Logger.ErrorException("Error sending playback stop checking for {0}", ex, item.Name); - } - } - - /// - /// Marks the watched. - /// - /// The items. - protected async void MarkWatched(IEnumerable items) - { - var idList = items.Where(i => !string.IsNullOrEmpty(i.Id)).Select(i => i.Id); - - try - { - await UIKernel.Instance.ApiClient.UpdatePlayedStatusAsync(idList.First(), App.Instance.CurrentUser.Id, true); - } - catch (HttpException ex) - { - Logger.ErrorException("Error marking items watched", ex); - } - } - - /// - /// Called when [media changed]. - /// - /// Old index of the playlist. - /// The ending position ticks. - /// New index of the playlist. - protected void OnMediaChanged(int oldPlaylistIndex, long? endingPositionTicks, int newPlaylistIndex) - { - DisposeProgressUpdateTimer(); - - Task.Run(() => - { - if (oldPlaylistIndex != -1) - { - SendPlaybackStopCheckIn(Playlist[oldPlaylistIndex], endingPositionTicks); - } - - if (newPlaylistIndex != -1) - { - SendPlaybackStartCheckIn(Playlist[newPlaylistIndex]); - } - }); - - ReloadProgressUpdateTimer(); - } - } -} diff --git a/MediaBrowser.UI/Playback/ExternalPlayer/BaseExternalPlayer.cs b/MediaBrowser.UI/Playback/ExternalPlayer/BaseExternalPlayer.cs deleted file mode 100644 index c50911d71c..0000000000 --- a/MediaBrowser.UI/Playback/ExternalPlayer/BaseExternalPlayer.cs +++ /dev/null @@ -1,243 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Logging; -using MediaBrowser.UI.Configuration; -using MediaBrowser.UI.UserInput; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace MediaBrowser.UI.Playback.ExternalPlayer -{ - /// - /// Class BaseExternalPlayer - /// - public abstract class BaseExternalPlayer : BaseMediaPlayer - { - protected BaseExternalPlayer(ILogger logger) : base(logger) - { - } - - /// - /// Gets a value indicating whether this instance can mute. - /// - /// true if this instance can mute; otherwise, false. - public override bool CanMute - { - get { return false; } - } - - /// - /// Gets a value indicating whether this instance can change volume. - /// - /// true if this instance can change volume; otherwise, false. - public override bool CanControlVolume - { - get { return false; } - } - - /// - /// Gets a value indicating whether this instance can close automatically. - /// - /// true if this instance can close automatically; otherwise, false. - protected virtual bool CanCloseAutomatically - { - get - { - return false; - } - } - - /// - /// Gets a value indicating whether [supports multi file playback]. - /// - /// true if [supports multi file playback]; otherwise, false. - public override bool SupportsMultiFilePlayback - { - get - { - return false; - } - } - - /// - /// Gets the current process. - /// - /// The current process. - protected Process CurrentProcess { get; private set; } - - /// - /// Gets the process start info. - /// - /// The items. - /// The options. - /// The player configuration. - /// ProcessStartInfo. - protected virtual ProcessStartInfo GetProcessStartInfo(List items, PlayOptions options, PlayerConfiguration playerConfiguration) - { - return new ProcessStartInfo - { - FileName = playerConfiguration.Command, - Arguments = GetCommandArguments(items, options, playerConfiguration) - }; - } - - /// - /// Gets the command arguments. - /// - /// The items. - /// The options. - /// The player configuration. - /// System.String. - protected virtual string GetCommandArguments(List items, PlayOptions options, PlayerConfiguration playerConfiguration) - { - var args = playerConfiguration.Args; - - if (string.IsNullOrEmpty(args)) - { - return string.Empty; - } - - return GetCommandArguments(items, args); - } - - /// - /// Gets the command arguments. - /// - /// The items. - /// The format string. - /// System.String. - protected string GetCommandArguments(List items, string formatString) - { - var paths = items.Select(i => "\"" + GetPathForCommandLine(i) + "\""); - - return string.Format(formatString, string.Join(" ", paths.ToArray())); - } - - /// - /// Gets the path for command line. - /// - /// The item. - /// System.String. - protected virtual string GetPathForCommandLine(BaseItemDto item) - { - return item.Path; - } - - /// - /// Gets a value indicating whether this instance can queue. - /// - /// true if this instance can queue; otherwise, false. - public override bool CanQueue - { - get { return false; } - } - - /// - /// Gets a value indicating whether this instance can pause. - /// - /// true if this instance can pause; otherwise, false. - public override bool CanPause - { - get { return false; } - } - - /// - /// Gets a value indicating whether this instance can seek. - /// - /// true if this instance can seek; otherwise, false. - public override bool CanSeek - { - get { return false; } - } - - /// - /// Plays the internal. - /// - /// The items. - /// The options. - /// The player configuration. - protected override void PlayInternal(List items, PlayOptions options, PlayerConfiguration playerConfiguration) - { - CurrentProcess = new Process - { - EnableRaisingEvents = true, - StartInfo = GetProcessStartInfo(items, options, playerConfiguration) - }; - - Logger.Info("{0} {1}", CurrentProcess.StartInfo.FileName, CurrentProcess.StartInfo.Arguments); - - CurrentProcess.Start(); - - OnExternalPlayerLaunched(); - - if (!CanCloseAutomatically) - { - KeyboardListener.KeyDown += KeyboardListener_KeyDown; - } - - CurrentProcess.Exited += CurrentProcess_Exited; - } - - /// - /// Handles the KeyDown event of the KeyboardListener control. - /// - /// The source of the event. - /// The instance containing the event data. - void KeyboardListener_KeyDown(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.MediaStop) - { - var playstate = PlayState; - - if (playstate == PlayState.Paused || playstate == PlayState.Playing) - { - Stop(); - } - } - } - - /// - /// Handles the Exited event of the CurrentProcess control. - /// - /// The source of the event. - /// The instance containing the event data. - void CurrentProcess_Exited(object sender, EventArgs e) - { - var process = (Process)sender; - - process.Dispose(); - - OnPlayerStopped(CurrentPlaylistIndex, CurrentPositionTicks); - } - - /// - /// Stops the internal. - /// - /// Task. - protected override Task StopInternal() - { - return Task.Run(() => CurrentProcess.Kill()); - } - - /// - /// Called when [player stopped internal]. - /// - protected override void OnPlayerStoppedInternal() - { - KeyboardListener.KeyDown -= KeyboardListener_KeyDown; - - base.OnPlayerStoppedInternal(); - } - - /// - /// Called when [external player launched]. - /// - protected virtual void OnExternalPlayerLaunched() - { - - } - } -} diff --git a/MediaBrowser.UI/Playback/ExternalPlayer/GenericExternalPlayer.cs b/MediaBrowser.UI/Playback/ExternalPlayer/GenericExternalPlayer.cs deleted file mode 100644 index 9150280507..0000000000 --- a/MediaBrowser.UI/Playback/ExternalPlayer/GenericExternalPlayer.cs +++ /dev/null @@ -1,35 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Logging; - -namespace MediaBrowser.UI.Playback.ExternalPlayer -{ - /// - /// Class GenericExternalPlayer - /// - public class GenericExternalPlayer : BaseExternalPlayer - { - public GenericExternalPlayer(ILogger logger) - : base(logger) - { - } - - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get { return "Generic Player"; } - } - - /// - /// Determines whether this instance can play the specified item. - /// - /// The item. - /// true if this instance can play the specified item; otherwise, false. - public override bool CanPlay(BaseItemDto item) - { - return false; - } - } -} diff --git a/MediaBrowser.UI/Playback/InternalPlayer/BaseInternalMediaPlayer.cs b/MediaBrowser.UI/Playback/InternalPlayer/BaseInternalMediaPlayer.cs deleted file mode 100644 index e9178d3f53..0000000000 --- a/MediaBrowser.UI/Playback/InternalPlayer/BaseInternalMediaPlayer.cs +++ /dev/null @@ -1,54 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Logging; -using MediaBrowser.UI.Configuration; -using System.Collections.Generic; -using System.Windows; - -namespace MediaBrowser.UI.Playback.InternalPlayer -{ - /// - /// Class BaseInternalMediaPlayer - /// - public abstract class BaseInternalMediaPlayer : BaseMediaPlayer - { - protected BaseInternalMediaPlayer(ILogger logger) : base(logger) - { - } - - /// - /// Ensures the media player created. - /// - protected abstract void EnsureMediaPlayerCreated(); - - /// - /// Plays the internal. - /// - /// The items. - /// The options. - /// The player configuration. - protected override void PlayInternal(List items, PlayOptions options, PlayerConfiguration playerConfiguration) - { - App.Instance.ApplicationWindow.Dispatcher.Invoke(() => - { - App.Instance.ApplicationWindow.BackdropContainer.Visibility = Visibility.Collapsed; - App.Instance.ApplicationWindow.WindowBackgroundContent.SetResourceReference(FrameworkElement.StyleProperty, "WindowBackgroundContentDuringPlayback"); - }); - - App.Instance.NavigateToInternalPlayerPage(); - } - - /// - /// Called when [player stopped internal]. - /// - protected override void OnPlayerStoppedInternal() - { - App.Instance.ApplicationWindow.Dispatcher.Invoke(() => - { - App.Instance.ApplicationWindow.BackdropContainer.Visibility = Visibility.Visible; - App.Instance.ApplicationWindow.WindowBackgroundContent.SetResourceReference(FrameworkElement.StyleProperty, "WindowBackgroundContent"); - }); - - base.OnPlayerStoppedInternal(); - } - } -} diff --git a/MediaBrowser.UI/Playback/NVlc/InternalMediaPlayerNVlc.cs b/MediaBrowser.UI/Playback/NVlc/InternalMediaPlayerNVlc.cs deleted file mode 100644 index 2d596655b5..0000000000 --- a/MediaBrowser.UI/Playback/NVlc/InternalMediaPlayerNVlc.cs +++ /dev/null @@ -1,426 +0,0 @@ -using Declarations.Events; -using Declarations.Media; -using Declarations.Players; -using Implementation; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Logging; -using MediaBrowser.UI.Configuration; -using MediaBrowser.UI.Playback.InternalPlayer; -using System; -using System.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace MediaBrowser.UI.Playback.NVlc -{ - /// - /// Class InternalMediaPlayer - /// - public class InternalMediaPlayerNVlc : BaseInternalMediaPlayer - { - public InternalMediaPlayerNVlc(ILogger logger) - : base(logger) - { - } - - /// - /// Gets or sets the media player factory. - /// - /// The media player factory. - private MediaPlayerFactory MediaPlayerFactory { get; set; } - - /// - /// Gets or sets the video player. - /// - /// The video player. - private IMediaListPlayer VideoPlayer { get; set; } - - /// - /// Gets or sets the media list. - /// - /// The media list. - private IMediaList MediaList { get; set; } - - /// - /// Gets a value indicating whether [supports multi file playback]. - /// - /// true if [supports multi file playback]; otherwise, false. - public override bool SupportsMultiFilePlayback - { - get { return true; } - } - - /// - /// Gets a value indicating whether this instance can mute. - /// - /// true if this instance can mute; otherwise, false. - public override bool CanMute - { - get { return true; } - } - - /// - /// Gets a value indicating whether this instance can change volume. - /// - /// true if this instance can change volume; otherwise, false. - public override bool CanControlVolume - { - get { return true; } - } - - /// - /// Gets a value indicating whether this instance is muted. - /// - /// true if this instance is muted; otherwise, false. - protected override bool IsMuted - { - get { return VideoPlayer != null && VideoPlayer.InnerPlayer.Mute; } - } - - /// - /// The _current playlist index - /// - private int _currentPlaylistIndex; - - /// - /// Gets the index of the current playlist. - /// - /// The index of the current playlist. - public override int CurrentPlaylistIndex - { - get - { - return _currentPlaylistIndex; - } - } - - /// - /// Gets the current position ticks. - /// - /// The current position ticks. - public override long? CurrentPositionTicks - { - get - { - if (VideoPlayer != null) - { - return TimeSpan.FromMilliseconds(VideoPlayer.Time).Ticks; - } - - return base.CurrentPositionTicks; - } - } - - /// - /// Gets a value indicating whether this instance can monitor progress. - /// - /// true if this instance can monitor progress; otherwise, false. - protected override bool CanMonitorProgress - { - get - { - return true; - } - } - - /// - /// Gets or sets the windows forms panel. - /// - /// The windows forms panel. - private Panel WindowsFormsPanel { get; set; } - - /// - /// Ensures the player. - /// - protected override void EnsureMediaPlayerCreated() - { - if (MediaPlayerFactory != null) - { - return; - } - - WindowsFormsPanel = new Panel(); - WindowsFormsPanel.BackColor = Color.Black; - - App.Instance.HiddenWindow.WindowsFormsHost.Child = WindowsFormsPanel; - - MediaPlayerFactory = new MediaPlayerFactory(new[] - { - "-I", - "dummy", - "--ignore-config", - "--no-osd", - "--disable-screensaver", - //"--ffmpeg-hw", - "--plugin-path=./plugins" - }); - } - - /// - /// Events_s the media changed. - /// - /// The sender. - /// The e. - void Events_MediaChanged(object sender, MediaPlayerMediaChanged e) - { - //var current = MediaList.FirstOrDefault(i => i.Tag == e.NewMedia.Tag); - - //var newIndex = current != null ? MediaList.IndexOf(current) : -1; - - //var currentIndex = _currentPlaylistIndex; - - //if (newIndex != currentIndex) - //{ - // OnMediaChanged(currentIndex, null, newIndex); - //} - - //_currentPlaylistIndex = newIndex; - } - - /// - /// Determines whether this instance can play the specified item. - /// - /// The item. - /// true if this instance can play the specified item; otherwise, false. - public override bool CanPlay(BaseItemDto item) - { - return item.IsVideo || item.IsAudio; - } - - /// - /// Gets a value indicating whether this instance can queue. - /// - /// true if this instance can queue; otherwise, false. - public override bool CanQueue - { - get { return true; } - } - - /// - /// Plays the internal. - /// - /// The items. - /// The options. - /// The player configuration. - protected override void PlayInternal(List items, PlayOptions options, PlayerConfiguration playerConfiguration) - { - EnsureMediaPlayerCreated(); - - _currentPlaylistIndex = 0; - - MediaList = MediaPlayerFactory.CreateMediaList(items.Select(GetPlayablePath)); - VideoPlayer = MediaPlayerFactory.CreateMediaListPlayer(MediaList); - - VideoPlayer.InnerPlayer.WindowHandle = WindowsFormsPanel.Handle; - - VideoPlayer.InnerPlayer.Events.PlayerStopped += Events_PlayerStopped; - VideoPlayer.Play(); - - var position = options.StartPositionTicks; - - if (position > 0) - { - VideoPlayer.Time = Convert.ToInt64(TimeSpan.FromTicks(position).TotalMilliseconds); - } - - VideoPlayer.MediaListPlayerEvents.MediaListPlayerNextItemSet += MediaListPlayerEvents_MediaListPlayerNextItemSet; - - base.PlayInternal(items, options, playerConfiguration); - } - - /// - /// Gets the playable path. - /// - /// The item. - /// System.String. - private string GetPlayablePath(BaseItemDto item) - { - if (item.VideoType.HasValue && item.VideoType.Value == VideoType.BluRay) - { - var file = Directory.EnumerateFiles(item.Path, "*.m2ts", SearchOption.AllDirectories).OrderByDescending(f => new FileInfo(f).Length).FirstOrDefault(); - - if (!string.IsNullOrEmpty(file)) - { - return file; - } - } - - return item.Path; - } - - /// - /// Medias the list player events_ media list player next item set. - /// - /// The sender. - /// The e. - void MediaListPlayerEvents_MediaListPlayerNextItemSet(object sender, MediaListPlayerNextItemSet e) - { - } - - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get { return "Internal Player"; } - } - - /// - /// Gets a value indicating whether this instance can pause. - /// - /// true if this instance can pause; otherwise, false. - public override bool CanPause - { - get { return true; } - } - - /// - /// Gets a value indicating whether this instance can seek. - /// - /// true if this instance can seek; otherwise, false. - public override bool CanSeek - { - get { return true; } - } - - /// - /// Queues the internal. - /// - /// The items. - protected override void QueueInternal(List items) - { - } - - /// - /// Seeks the internal. - /// - /// The position ticks. - /// Task. - protected override Task SeekInternal(long positionTicks) - { - return Task.Run(() => VideoPlayer.Time = Convert.ToInt64(TimeSpan.FromTicks(positionTicks).TotalMilliseconds)); - } - - /// - /// Pauses the internal. - /// - /// Task. - protected override Task PauseInternal() - { - return Task.Run(() => VideoPlayer.Pause()); - } - - /// - /// Uns the pause internal. - /// - /// Task. - protected override Task UnPauseInternal() - { - return Task.Run(() => VideoPlayer.Pause()); - } - - /// - /// Stops the internal. - /// - /// Task. - protected override Task StopInternal() - { - return Task.Run(() => VideoPlayer.Stop()); - } - - /// - /// Handles the PlayerStopped event of the Events control. - /// - /// The source of the event. - /// The instance containing the event data. - void Events_PlayerStopped(object sender, EventArgs e) - { - OnPlayerStopped(CurrentPlaylistIndex, CurrentPositionTicks); - } - - /// - /// Called when [player stopped]. - /// - protected override void OnPlayerStoppedInternal() - { - VideoPlayer.MediaListPlayerEvents.MediaListPlayerNextItemSet -= MediaListPlayerEvents_MediaListPlayerNextItemSet; - - MediaList.Dispose(); - - VideoPlayer.InnerPlayer.Events.PlayerStopped -= Events_PlayerStopped; - VideoPlayer.InnerPlayer.Dispose(); - - //VideoPlayer.Dispose(); - VideoPlayer = null; - - _currentPlaylistIndex = 0; - - base.OnPlayerStoppedInternal(); - } - - /// - /// Gets the volume. - /// - /// System.Int32. - protected override int GetVolume() - { - return VideoPlayer.InnerPlayer.Volume; - } - - /// - /// Sets the volume, on a scale from 0-100 - /// - /// The value. - protected override void SetVolume(int value) - { - if (value > 0 && VideoPlayer.InnerPlayer.Mute) - { - VideoPlayer.InnerPlayer.Mute = false; - } - - VideoPlayer.InnerPlayer.Volume = value; - } - - /// - /// Sets the mute. - /// - /// if set to true [mute]. - protected override void SetMute(bool mute) - { - VideoPlayer.InnerPlayer.Mute = mute; - } - - /// - /// Releases unmanaged and - optionally - managed resources. - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected override void Dispose(bool dispose) - { - base.Dispose(dispose); - - if (dispose) - { - if (MediaList != null) - { - MediaList.Dispose(); - } - if (VideoPlayer != null) - { - if (VideoPlayer.InnerPlayer != null) - { - VideoPlayer.InnerPlayer.Dispose(); - } - } - if (MediaPlayerFactory != null) - { - MediaPlayerFactory.Dispose(); - } - } - } - } -} diff --git a/MediaBrowser.UI/Playback/PlayOptions.cs b/MediaBrowser.UI/Playback/PlayOptions.cs deleted file mode 100644 index 276e611b9c..0000000000 --- a/MediaBrowser.UI/Playback/PlayOptions.cs +++ /dev/null @@ -1,89 +0,0 @@ -using MediaBrowser.Model.Dto; -using System; -using System.Collections.Generic; - -namespace MediaBrowser.UI.Playback -{ - /// - /// Class PlayOptions - /// - public class PlayOptions - { - /// - /// Gets or sets the items. - /// - /// The items. - public List Items { get; set; } - - /// - /// If true, the PlayableItems will be shuffled before playback - /// - /// true if shuffle; otherwise, false. - public bool Shuffle { get; set; } - - /// - /// If true, Playback will be resumed from the last known position - /// - /// true if resume; otherwise, false. - public bool Resume { get; set; } - - private long? _startPositionTicks; - /// - /// Gets or sets the start position ticks. - /// - /// The start position ticks. - public long StartPositionTicks - { - get - { - if (_startPositionTicks.HasValue) - { - return _startPositionTicks.Value; - } - - if (Resume && Items.Count > 0) - { - var item = Items[0]; - - if (item.UserData != null) - { - return item.UserData.PlaybackPositionTicks; - } - } - - return 0; - } - set - { - _startPositionTicks = value; - } - } - - /// - /// Holds the time that playback was started - /// - /// The playback start time. - public DateTime PlaybackStartTime { get; private set; } - - /// - /// The _show now playing view - /// - private bool _showNowPlayingView = true; - /// - /// Determines whether or not the PlaybackController should show the now playing view during playback - /// Note that this depends on PlaybackController implementation and support - /// - /// true if [show now playing view]; otherwise, false. - public bool ShowNowPlayingView { get { return _showNowPlayingView; } set { _showNowPlayingView = value; } } - - /// - /// The _go full screen - /// - private bool _goFullScreen = true; - /// - /// Determines whether or not the PlaybackController should go full screen upon beginning playback - /// - /// true if [go full screen]; otherwise, false. - public bool GoFullScreen { get { return _goFullScreen; } set { _goFullScreen = value; } } - } -} diff --git a/MediaBrowser.UI/Playback/PlayState.cs b/MediaBrowser.UI/Playback/PlayState.cs deleted file mode 100644 index d166c4a776..0000000000 --- a/MediaBrowser.UI/Playback/PlayState.cs +++ /dev/null @@ -1,24 +0,0 @@ - -namespace MediaBrowser.UI.Playback -{ - /// - /// Enum PlayState - /// - public enum PlayState - { - /// - /// The idle - /// - Idle, - - /// - /// The playing - /// - Playing, - - /// - /// The paused - /// - Paused - } -} diff --git a/MediaBrowser.UI/Playback/PlaybackEventArgs.cs b/MediaBrowser.UI/Playback/PlaybackEventArgs.cs deleted file mode 100644 index a2eef782a6..0000000000 --- a/MediaBrowser.UI/Playback/PlaybackEventArgs.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Collections.Generic; -using MediaBrowser.Model.Dto; -using MediaBrowser.UI.Configuration; -using System; - -namespace MediaBrowser.UI.Playback -{ - /// - /// Class PlaybackEventArgs - /// - public class PlaybackEventArgs : EventArgs - { - /// - /// Gets or sets the player. - /// - /// The player. - public BaseMediaPlayer Player { get; set; } - - /// - /// Gets or sets the options. - /// - /// The options. - public PlayOptions Options { get; set; } - - /// - /// Gets or sets the player configuration. - /// - /// The player configuration. - public PlayerConfiguration PlayerConfiguration { get; set; } - } - - /// - /// Class PlaybackStopEventArgs - /// - public class PlaybackStopEventArgs : EventArgs - { - /// - /// Gets or sets the player. - /// - /// The player. - public BaseMediaPlayer Player { get; set; } - - /// - /// Gets or sets the items. - /// - /// The items. - public List Items { get; set; } - } -} diff --git a/MediaBrowser.UI/Playback/PlaybackManager.cs b/MediaBrowser.UI/Playback/PlaybackManager.cs deleted file mode 100644 index eedcad9b35..0000000000 --- a/MediaBrowser.UI/Playback/PlaybackManager.cs +++ /dev/null @@ -1,301 +0,0 @@ -using MediaBrowser.Common.Events; -using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.Kernel; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Logging; -using MediaBrowser.Model.Net; -using MediaBrowser.UI.Configuration; -using MediaBrowser.UI.Controller; -using MediaBrowser.UI.Playback.InternalPlayer; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; - -namespace MediaBrowser.UI.Playback -{ - /// - /// Class PlaybackManager - /// - public class PlaybackManager : BaseManager - { - private readonly ILogger _logger; - - /// - /// Initializes a new instance of the class. - /// - /// The kernel. - public PlaybackManager(UIKernel kernel, ILogger logger) - : base(kernel) - { - _logger = logger; - } - - #region PlaybackStarted Event - /// - /// Occurs when [playback started]. - /// - public event EventHandler PlaybackStarted; - - /// - /// Called when [playback started]. - /// - /// The player. - /// The options. - /// The player configuration. - private void OnPlaybackStarted(BaseMediaPlayer player, PlayOptions options, PlayerConfiguration playerConfiguration) - { - EventHelper.QueueEventIfNotNull(PlaybackStarted, this, new PlaybackEventArgs - { - Options = options, - Player = player, - PlayerConfiguration = playerConfiguration - }, _logger); - } - #endregion - - #region PlaybackCompleted Event - /// - /// Occurs when [playback completed]. - /// - public event EventHandler PlaybackCompleted; - - /// - /// Called when [playback completed]. - /// - /// The player. - /// The items. - internal void OnPlaybackCompleted(BaseMediaPlayer player, List items) - { - EventHelper.QueueEventIfNotNull(PlaybackCompleted, this, new PlaybackStopEventArgs - { - Items = items, - Player = player - }, _logger); - } - #endregion - - /// - /// Gets the active players. - /// - /// The active players. - public IEnumerable ActivePlayers - { - get - { - return Kernel.MediaPlayers.Where(m => m.PlayState != PlayState.Idle); - } - } - - /// - /// Gets the active internal players. - /// - /// The active internal players. - public IEnumerable ActiveInternalPlayers - { - get { return ActivePlayers.Where(p => p is BaseInternalMediaPlayer); } - } - - /// - /// Plays the specified items. - /// - /// The options. - /// Task. - /// - /// - public async Task Play(PlayOptions options) - { - if (options == null) - { - throw new ArgumentNullException("options"); - } - - if (options.Items == null || options.Items.Count == 0) - { - throw new ArgumentNullException("options"); - } - - var player = GetPlayer(options.Items); - - if (player != null) - { - await StopAllPlayback(); - - await Play(player.Item1, options, player.Item2); - } - else - { - throw new InvalidOperationException(); - } - } - - /// - /// Plays the specified player. - /// - /// The player. - /// The options. - /// The player configuration. - /// Task. - private async Task Play(BaseMediaPlayer player, PlayOptions options, PlayerConfiguration playerConfiguration) - { - if (options.Shuffle) - { - options.Items = options.Items.Shuffle().ToList(); - } - - var firstItem = options.Items[0]; - - if (options.StartPositionTicks == 0 && player.SupportsMultiFilePlayback && firstItem.IsVideo && firstItem.LocationType == LocationType.FileSystem) - { - try - { - var intros = await UIKernel.Instance.ApiClient.GetIntrosAsync(firstItem.Id, App.Instance.CurrentUser.Id); - - options.Items.InsertRange(0, intros.Select(GetPlayableItem)); - } - catch (HttpException ex) - { - _logger.ErrorException("Error retrieving intros", ex); - } - } - - await player.Play(options, playerConfiguration); - - OnPlaybackStarted(player, options, playerConfiguration); - } - - /// - /// Gets the playable item. - /// - /// The path. - /// BaseItemDto. - public BaseItemDto GetPlayableItem(string path) - { - return new BaseItemDto - { - Path = path, - Name = Path.GetFileName(path), - Type = "Video", - VideoType = VideoType.VideoFile, - IsFolder = false - }; - } - - /// - /// Gets the playable item. - /// - /// The URI. - /// The name. - /// BaseItemDto. - public BaseItemDto GetPlayableItem(Uri uri, string name) - { - return new BaseItemDto - { - Path = uri.ToString(), - Name = name, - Type = "Video", - VideoType = VideoType.VideoFile, - IsFolder = false, - LocationType = LocationType.Remote - }; - } - - /// - /// Stops all playback. - /// - /// Task. - public async Task StopAllPlayback() - { - var tasks = Kernel.MediaPlayers.Where(p => p.PlayState == PlayState.Playing || p.PlayState == PlayState.Paused).Select(p => p.Stop()); - - await Task.WhenAll(tasks); - } - - /// - /// Gets the player. - /// - /// The items. - /// BaseMediaPlayer. - private Tuple GetPlayer(List items) - { - var player = GetConfiguredPlayer(items); - - if (player != null) - { - return player; - } - - // If there's no explicit configuration just find the first matching player - var mediaPlayer = Kernel.MediaPlayers.OfType().FirstOrDefault(p => items.All(p.CanPlay)); - - if (mediaPlayer != null) - { - return new Tuple(mediaPlayer, null); - } - - return null; - } - - /// - /// Gets the configured player. - /// - /// The items. - /// BaseMediaPlayer. - private Tuple GetConfiguredPlayer(List items) - { - if (UIKernel.Instance.Configuration.MediaPlayers == null) - { - return null; - } - - return UIKernel.Instance.Configuration.MediaPlayers.Where(p => IsConfiguredToPlay(p, items)) - .Select(p => new Tuple(UIKernel.Instance.MediaPlayers.FirstOrDefault(m => m.Name.Equals(p.PlayerName, StringComparison.OrdinalIgnoreCase)), p)) - .FirstOrDefault(p => p.Item1 != null); - } - - /// - /// Determines whether [is configured to play] [the specified configuration]. - /// - /// The configuration. - /// The items. - /// true if [is configured to play] [the specified configuration]; otherwise, false. - private bool IsConfiguredToPlay(PlayerConfiguration configuration, List items) - { - if (configuration.ItemTypes != null && configuration.ItemTypes.Length > 0) - { - if (items.Any(i => !configuration.ItemTypes.Contains(i.Type, StringComparer.OrdinalIgnoreCase))) - { - return false; - } - } - - if (configuration.FileExtensions != null && configuration.FileExtensions.Length > 0) - { - if (items.Any(i => !configuration.FileExtensions.Select(ext => ext.TrimStart('.')).Contains((Path.GetExtension(i.Path) ?? string.Empty).TrimStart('.'), StringComparer.OrdinalIgnoreCase))) - { - return false; - } - } - - if (configuration.VideoTypes != null && configuration.VideoTypes.Length > 0) - { - if (items.Any(i => i.VideoType.HasValue && !configuration.VideoTypes.Contains(i.VideoType.Value))) - { - return false; - } - } - - if (configuration.VideoFormats != null && configuration.VideoFormats.Length > 0) - { - if (items.Any(i => i.VideoFormat.HasValue && !configuration.VideoFormats.Contains(i.VideoFormat.Value))) - { - return false; - } - } - - return true; - } - } -} diff --git a/MediaBrowser.UI/Properties/AssemblyInfo.cs b/MediaBrowser.UI/Properties/AssemblyInfo.cs deleted file mode 100644 index 4203ef319b..0000000000 --- a/MediaBrowser.UI/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("MediaBrowser.UI")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Media Browser Team")] -[assembly: AssemblyProduct("MediaBrowser.UI")] -[assembly: AssemblyCopyright("Copyright © 2012")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.9.*")] diff --git a/MediaBrowser.UI/Properties/Resources.Designer.cs b/MediaBrowser.UI/Properties/Resources.Designer.cs deleted file mode 100644 index b9d7426209..0000000000 --- a/MediaBrowser.UI/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.17626 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace MediaBrowser.UI.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediaBrowser.UI.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} diff --git a/MediaBrowser.UI/Properties/Resources.resx b/MediaBrowser.UI/Properties/Resources.resx deleted file mode 100644 index ffecec851a..0000000000 --- a/MediaBrowser.UI/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/MediaBrowser.UI/Properties/Settings.Designer.cs b/MediaBrowser.UI/Properties/Settings.Designer.cs deleted file mode 100644 index 4d9ddf50d1..0000000000 --- a/MediaBrowser.UI/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.17626 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace MediaBrowser.UI.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/MediaBrowser.UI/Properties/Settings.settings b/MediaBrowser.UI/Properties/Settings.settings deleted file mode 100644 index 8f2fd95d62..0000000000 --- a/MediaBrowser.UI/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.UI/Resources/AppResources.xaml b/MediaBrowser.UI/Resources/AppResources.xaml deleted file mode 100644 index 9d59c2d966..0000000000 --- a/MediaBrowser.UI/Resources/AppResources.xaml +++ /dev/null @@ -1,383 +0,0 @@ - - - - Segoe UI, Lucida Sans Unicode, Verdana - Normal - #333 - 30 - - - Segoe UI, Lucida Sans Unicode, Verdana - Normal - #333 - 20 - - - 68 - Segoe UI, Lucida Sans Unicode, Verdana - Thin - #333 - - - 42 - Segoe UI, Lucida Sans Unicode, Verdana - Normal - #333 - - SkyBlue - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.UI/Resources/Images/Icon.ico b/MediaBrowser.UI/Resources/Images/Icon.ico deleted file mode 100644 index 0f7d8c9553..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/Icon.ico and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/MessageBox/Asterisk.png b/MediaBrowser.UI/Resources/Images/MessageBox/Asterisk.png deleted file mode 100644 index 0bc86ef4fa..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/MessageBox/Asterisk.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/MessageBox/Error.png b/MediaBrowser.UI/Resources/Images/MessageBox/Error.png deleted file mode 100644 index 039a864ea9..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/MessageBox/Error.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/MessageBox/Exclamation.png b/MediaBrowser.UI/Resources/Images/MessageBox/Exclamation.png deleted file mode 100644 index 039a864ea9..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/MessageBox/Exclamation.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/MessageBox/Hand.png b/MediaBrowser.UI/Resources/Images/MessageBox/Hand.png deleted file mode 100644 index 4adf793a28..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/MessageBox/Hand.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/MessageBox/Information.png b/MediaBrowser.UI/Resources/Images/MessageBox/Information.png deleted file mode 100644 index 3fd09c1bca..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/MessageBox/Information.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/MessageBox/Question.png b/MediaBrowser.UI/Resources/Images/MessageBox/Question.png deleted file mode 100644 index 6aabd219bd..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/MessageBox/Question.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/MessageBox/Stop.png b/MediaBrowser.UI/Resources/Images/MessageBox/Stop.png deleted file mode 100644 index cdbcbacedb..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/MessageBox/Stop.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/MessageBox/Warning.png b/MediaBrowser.UI/Resources/Images/MessageBox/Warning.png deleted file mode 100644 index 6467ed54b9..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/MessageBox/Warning.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/NavBar/BackButton.png b/MediaBrowser.UI/Resources/Images/NavBar/BackButton.png deleted file mode 100644 index f72f445636..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/NavBar/BackButton.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/NavBar/MediaBack.png b/MediaBrowser.UI/Resources/Images/NavBar/MediaBack.png deleted file mode 100644 index 601bdbcb58..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/NavBar/MediaBack.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/NavBar/MediaFastForward.png b/MediaBrowser.UI/Resources/Images/NavBar/MediaFastForward.png deleted file mode 100644 index 666557dd2d..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/NavBar/MediaFastForward.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/NavBar/MediaForward.png b/MediaBrowser.UI/Resources/Images/NavBar/MediaForward.png deleted file mode 100644 index e63767fc05..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/NavBar/MediaForward.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/NavBar/MediaRewind.png b/MediaBrowser.UI/Resources/Images/NavBar/MediaRewind.png deleted file mode 100644 index fd7afa031a..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/NavBar/MediaRewind.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/NavBar/MuteButton.png b/MediaBrowser.UI/Resources/Images/NavBar/MuteButton.png deleted file mode 100644 index c642a36c52..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/NavBar/MuteButton.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/NavBar/PauseButton.png b/MediaBrowser.UI/Resources/Images/NavBar/PauseButton.png deleted file mode 100644 index edac58049a..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/NavBar/PauseButton.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/NavBar/PlayButton.png b/MediaBrowser.UI/Resources/Images/NavBar/PlayButton.png deleted file mode 100644 index 52ca33ed05..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/NavBar/PlayButton.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/NavBar/StopButton.png b/MediaBrowser.UI/Resources/Images/NavBar/StopButton.png deleted file mode 100644 index b394ddf600..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/NavBar/StopButton.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/NavBar/VolumeDownButton.png b/MediaBrowser.UI/Resources/Images/NavBar/VolumeDownButton.png deleted file mode 100644 index 0c8617a43a..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/NavBar/VolumeDownButton.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/NavBar/VolumeUpButton.png b/MediaBrowser.UI/Resources/Images/NavBar/VolumeUpButton.png deleted file mode 100644 index 80d80e6479..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/NavBar/VolumeUpButton.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/mblogoblack.png b/MediaBrowser.UI/Resources/Images/mblogoblack.png deleted file mode 100644 index e167489784..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/mblogoblack.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/mblogoblackfull.png b/MediaBrowser.UI/Resources/Images/mblogoblackfull.png deleted file mode 100644 index 340f12d9df..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/mblogoblackfull.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/mblogowhite.png b/MediaBrowser.UI/Resources/Images/mblogowhite.png deleted file mode 100644 index b6b0f158b4..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/mblogowhite.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/Images/mblogowhitefull.png b/MediaBrowser.UI/Resources/Images/mblogowhitefull.png deleted file mode 100644 index 48c8f72d39..0000000000 Binary files a/MediaBrowser.UI/Resources/Images/mblogowhitefull.png and /dev/null differ diff --git a/MediaBrowser.UI/Resources/MainWindowResources.xaml b/MediaBrowser.UI/Resources/MainWindowResources.xaml deleted file mode 100644 index fde1e168d6..0000000000 --- a/MediaBrowser.UI/Resources/MainWindowResources.xaml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.UI/Resources/ModalMessage.xaml b/MediaBrowser.UI/Resources/ModalMessage.xaml deleted file mode 100644 index 9ae288c1d0..0000000000 --- a/MediaBrowser.UI/Resources/ModalMessage.xaml +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.UI/Resources/NavBarResources.xaml b/MediaBrowser.UI/Resources/NavBarResources.xaml deleted file mode 100644 index 771c037a7a..0000000000 --- a/MediaBrowser.UI/Resources/NavBarResources.xaml +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.UI/Resources/NotificationMessage.xaml b/MediaBrowser.UI/Resources/NotificationMessage.xaml deleted file mode 100644 index 5591e9e0d0..0000000000 --- a/MediaBrowser.UI/Resources/NotificationMessage.xaml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.UI/UserInput/KeyboardListener.cs b/MediaBrowser.UI/UserInput/KeyboardListener.cs deleted file mode 100644 index 76ce8e15ab..0000000000 --- a/MediaBrowser.UI/UserInput/KeyboardListener.cs +++ /dev/null @@ -1,210 +0,0 @@ -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; -using System.Windows.Forms; - -namespace MediaBrowser.UI.UserInput -{ - /// - /// Provides a basic low-level keyboard listener - /// Inspired by http://blogs.msdn.com/b/toub/archive/2006/05/03/589423.aspx - /// Use the KeyDown event to listen for keys. - /// Make sure to detach from the event when not needed. - /// - public static class KeyboardListener - { - #region KeyDown EventHandler - /// - /// The _ key down - /// - static volatile EventHandler _KeyDown; - /// - /// Fires whenever CurrentItem changes - /// - public static event EventHandler KeyDown - { - add - { - if (_KeyDown == null) - { - StartListening(); - } - - _KeyDown += value; - } - remove - { - _KeyDown -= value; - - if (_KeyDown == null && _hookID != IntPtr.Zero) - { - StopListening(); - } - } - } - - /// - /// Raises the event. - /// - /// The instance containing the event data. - private static void OnKeyDown(KeyEventArgs e) - { - e.SuppressKeyPress = false; - - if (_KeyDown != null) - { - // For now, don't async this - // This will give listeners a chance to modify SuppressKeyPress if they want - try - { - _KeyDown(null, e); - } - catch (Exception ex) - { - } - } - } - #endregion - - /// - /// The W h_ KEYBOAR d_ LL - /// - private const int WH_KEYBOARD_LL = 13; - /// - /// The W m_ KEYDOWN - /// - private const int WM_KEYDOWN = 0x0100; - /// - /// The W m_ SYSKEYDOWN - /// - private const int WM_SYSKEYDOWN = 0x0104; - - /// - /// The _hook ID - /// - private static IntPtr _hookID = IntPtr.Zero; - /// - /// The _proc - /// - private static LowLevelKeyboardProc _proc = HookCallback; - - /// - /// Starts the listening. - /// - private static void StartListening() - { - _hookID = SetHook(_proc); - } - - /// - /// Stops the listening. - /// - private static void StopListening() - { - UnhookWindowsHookEx(_hookID); - _hookID = IntPtr.Zero; - } - - /// - /// Sets the hook. - /// - /// The proc. - /// IntPtr. - private static IntPtr SetHook(LowLevelKeyboardProc proc) - { - using (var curProcess = Process.GetCurrentProcess()) - using (var curModule = curProcess.MainModule) - { - return SetWindowsHookEx(WH_KEYBOARD_LL, proc, - GetModuleHandle(curModule.ModuleName), 0); - } - } - - /// - /// Hooks the callback. - /// - /// The n code. - /// The w param. - /// The l param. - /// IntPtr. - private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) - { - var suppressKeyPress = false; - - if (nCode >= 0) - { - if (wParam == (IntPtr)WM_KEYDOWN || wParam == (IntPtr)WM_SYSKEYDOWN) - { - var vkCode = Marshal.ReadInt32(lParam); - - var keyData = (Keys)vkCode; - - var e = new KeyEventArgs(keyData); - - OnKeyDown(e); - - suppressKeyPress = e.SuppressKeyPress; - } - } - - if (suppressKeyPress) - { - return IntPtr.Zero; - } - - return CallNextHookEx(_hookID, nCode, wParam, lParam); - } - - /// - /// Delegate LowLevelKeyboardProc - /// - /// The n code. - /// The w param. - /// The l param. - /// IntPtr. - private delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam); - - #region Imports - /// - /// Sets the windows hook ex. - /// - /// The id hook. - /// The LPFN. - /// The h mod. - /// The dw thread id. - /// IntPtr. - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] - private static extern IntPtr SetWindowsHookEx(int idHook, - LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId); - - /// - /// Unhooks the windows hook ex. - /// - /// The HHK. - /// true if XXXX, false otherwise - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool UnhookWindowsHookEx(IntPtr hhk); - - /// - /// Calls the next hook ex. - /// - /// The HHK. - /// The n code. - /// The w param. - /// The l param. - /// IntPtr. - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] - private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, - IntPtr wParam, IntPtr lParam); - - /// - /// Gets the module handle. - /// - /// Name of the lp module. - /// IntPtr. - [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] - private static extern IntPtr GetModuleHandle(string lpModuleName); - #endregion - } -} diff --git a/MediaBrowser.UI/ViewModels/BaseItemPersonViewModel.cs b/MediaBrowser.UI/ViewModels/BaseItemPersonViewModel.cs deleted file mode 100644 index 3de9d72cf1..0000000000 --- a/MediaBrowser.UI/ViewModels/BaseItemPersonViewModel.cs +++ /dev/null @@ -1,27 +0,0 @@ -using MediaBrowser.Model.Dto; - -namespace MediaBrowser.UI.ViewModels -{ - public class BaseItemPersonViewModel : BaseViewModel - { - /// - /// The _item - /// - private BaseItemPerson _item; - /// - /// Gets or sets the item. - /// - /// The item. - public BaseItemPerson Item - { - get { return _item; } - - set - { - _item = value; - OnPropertyChanged("Item"); - OnPropertyChanged("Image"); - } - } - } -} diff --git a/MediaBrowser.UI/ViewModels/BaseViewModel.cs b/MediaBrowser.UI/ViewModels/BaseViewModel.cs deleted file mode 100644 index 03ac9d18a0..0000000000 --- a/MediaBrowser.UI/ViewModels/BaseViewModel.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.ComponentModel; - -namespace MediaBrowser.UI.ViewModels -{ - /// - /// Represents a base ViewModel - /// - public abstract class BaseViewModel : INotifyPropertyChanged - { - /// - /// Occurs when [property changed]. - /// - public event PropertyChangedEventHandler PropertyChanged; - - /// - /// Called when [property changed]. - /// - /// The name. - public virtual void OnPropertyChanged(string name) - { - if (PropertyChanged != null) - { - PropertyChanged(this, new PropertyChangedEventArgs(name)); - } - } - } -} diff --git a/MediaBrowser.UI/ViewModels/ChapterInfoDtoViewModel.cs b/MediaBrowser.UI/ViewModels/ChapterInfoDtoViewModel.cs deleted file mode 100644 index 131294ff25..0000000000 --- a/MediaBrowser.UI/ViewModels/ChapterInfoDtoViewModel.cs +++ /dev/null @@ -1,182 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Net; -using System; -using System.Linq; -using System.Windows.Media.Imaging; - -namespace MediaBrowser.UI.ViewModels -{ - /// - /// Class ChapterInfoDtoViewModel - /// - public class ChapterInfoDtoViewModel : BaseViewModel - { - /// - /// Gets or sets the image download options. - /// - /// The image download options. - public ImageOptions ImageDownloadOptions { get; set; } - - /// - /// The _image width - /// - private double _imageWidth; - /// - /// Gets or sets the width of the image. - /// - /// The width of the image. - public double ImageWidth - { - get { return _imageWidth; } - - set - { - _imageWidth = value; - OnPropertyChanged("ImageWidth"); - } - } - - /// - /// The _image height - /// - private double _imageHeight; - /// - /// Gets or sets the height of the image. - /// - /// The height of the image. - public double ImageHeight - { - get { return _imageHeight; } - - set - { - _imageHeight = value; - OnPropertyChanged("ImageHeight"); - } - } - - /// - /// The _item - /// - private ChapterInfoDto _chapter; - /// - /// Gets or sets the item. - /// - /// The item. - public ChapterInfoDto Chapter - { - get { return _chapter; } - - set - { - _chapter = value; - OnPropertyChanged("Chapter"); - OnPropertyChanged("TimeString"); - OnChapterChanged(); - } - } - - /// - /// The _item - /// - private BaseItemDto _item; - /// - /// Gets or sets the item. - /// - /// The item. - public BaseItemDto Item - { - get { return _item; } - - set - { - _item = value; - OnPropertyChanged("Item"); - } - } - - /// - /// Gets the time string. - /// - /// The time string. - public string TimeString - { - get - { - var time = TimeSpan.FromTicks(Chapter.StartPositionTicks); - - return time.ToString(time.TotalHours < 1 ? "m':'ss" : "h':'mm':'ss"); - } - } - - /// - /// The _image - /// - private BitmapImage _image; - /// - /// Gets the image. - /// - /// The image. - public BitmapImage Image - { - get { return _image; } - set - { - _image = value; - OnPropertyChanged("Image"); - } - } - - /// - /// Called when [item changed]. - /// - private async void OnChapterChanged() - { - var options = ImageDownloadOptions ?? new ImageOptions { }; - - options.ImageType = ImageType.ChapterImage; - options.ImageIndex = Item.Chapters.IndexOf(Chapter); - - try - { - Image = await App.Instance.GetRemoteBitmapAsync(App.Instance.ApiClient.GetImageUrl(Item, options)); - } - catch (HttpException) - { - } - } - - /// - /// Gets the height of the chapter image. - /// - /// The item. - /// The height. - /// The default width. - /// System.Double. - public static double GetChapterImageWidth(BaseItemDto item, double height, double defaultWidth) - { - var width = defaultWidth; - - if (item.MediaStreams != null) - { - var videoStream = item.MediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video); - - if (videoStream != null) - { - double streamHeight = videoStream.Height ?? 0; - double streamWidth = videoStream.Width ?? 0; - - if (streamHeight > 0 && streamWidth > 0) - { - var aspectRatio = streamWidth / streamHeight; - - width = height * aspectRatio; - } - } - } - - return width; - } - } -} diff --git a/MediaBrowser.UI/ViewModels/DtoBaseItemViewModel.cs b/MediaBrowser.UI/ViewModels/DtoBaseItemViewModel.cs deleted file mode 100644 index f8194e04b8..0000000000 --- a/MediaBrowser.UI/ViewModels/DtoBaseItemViewModel.cs +++ /dev/null @@ -1,183 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.UI.Pages; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; - -namespace MediaBrowser.UI.ViewModels -{ - /// - /// Class DtoBaseItemViewModel - /// - public class DtoBaseItemViewModel : BaseViewModel - { - /// - /// The _average primary image aspect ratio - /// - private double _averagePrimaryImageAspectRatio; - /// - /// Gets the aspect ratio that should be used if displaying the primary image - /// - /// The average primary image aspect ratio. - public double AveragePrimaryImageAspectRatio - { - get { return _averagePrimaryImageAspectRatio; } - - set - { - _averagePrimaryImageAspectRatio = value; - OnPropertyChanged("AveragePrimaryImageAspectRatio"); - } - } - - /// - /// The _parent display preferences - /// - private DisplayPreferences _parentDisplayPreferences; - /// - /// Gets of sets the current DisplayPreferences - /// - /// The parent display preferences. - public DisplayPreferences ParentDisplayPreferences - { - get { return _parentDisplayPreferences; } - - set - { - _parentDisplayPreferences = value; - NotifyDisplayPreferencesChanged(); - } - } - - /// - /// The _item - /// - private BaseItemDto _item; - /// - /// Gets or sets the item. - /// - /// The item. - public BaseItemDto Item - { - get { return _item; } - - set - { - _item = value; - OnPropertyChanged("Item"); - } - } - - /// - /// Notifies the display preferences changed. - /// - public void NotifyDisplayPreferencesChanged() - { - OnPropertyChanged("DisplayPreferences"); - } - - /// - /// Gets an image url that can be used to download an image from the api - /// - /// The type of image requested - /// The image index, if there are multiple. Currently only applies to backdrops. Supply null or 0 for first backdrop. - /// System.String. - public string GetImageUrl(ImageType imageType, int? imageIndex = null) - { - var height = ParentDisplayPreferences.PrimaryImageHeight; - - var averageAspectRatio = BaseFolderPage.GetAspectRatio(imageType, AveragePrimaryImageAspectRatio); - - var width = height * averageAspectRatio; - - var imageOptions = new ImageOptions - { - ImageType = imageType, - ImageIndex = imageIndex, - Height = height - }; - - if (imageType == ImageType.Primary) - { - var currentAspectRatio = imageType == ImageType.Primary ? Item.PrimaryImageAspectRatio ?? width / height : width / height; - - // Preserve the exact AR if it deviates from the average significantly - var preserveExactAspectRatio = Math.Abs(currentAspectRatio - averageAspectRatio) > .10; - - if (!preserveExactAspectRatio) - { - imageOptions.Width = Convert.ToInt32(width); - } - } - - return App.Instance.ApiClient.GetImageUrl(Item, imageOptions); - } - - /// - /// Gets the average primary image aspect ratio. - /// - /// The items. - /// System.Double. - /// items - public static double GetAveragePrimaryImageAspectRatio(IEnumerable items) - { - if (items == null) - { - throw new ArgumentNullException("items"); - } - - double total = 0; - var count = 0; - - foreach (var child in items) - { - var ratio = child.PrimaryImageAspectRatio ?? 0; - - if (ratio.Equals(0)) - { - continue; - } - - total += ratio; - count++; - } - - return count == 0 ? 1 : total / count; - } - - /// - /// Gets the observable items. - /// - /// The items. - /// ObservableCollection{DtoBaseItemViewModel}. - public static ObservableCollection GetObservableItems(BaseItemDto[] items) - { - return GetObservableItems(items, GetAveragePrimaryImageAspectRatio(items)); - } - - /// - /// Gets the observable items. - /// - /// The items. - /// The average primary image aspect ratio. - /// The parent display preferences. - /// ObservableCollection{DtoBaseItemViewModel}. - /// items - public static ObservableCollection GetObservableItems(IEnumerable items, double averagePrimaryImageAspectRatio, DisplayPreferences parentDisplayPreferences = null) - { - if (items == null) - { - throw new ArgumentNullException("items"); - } - - return new ObservableCollection(items.Select(i => new DtoBaseItemViewModel - { - Item = i, - ParentDisplayPreferences = parentDisplayPreferences, - AveragePrimaryImageAspectRatio = averagePrimaryImageAspectRatio - })); - } - } -} diff --git a/MediaBrowser.UI/ViewModels/ItemCollectionViewModel.cs b/MediaBrowser.UI/ViewModels/ItemCollectionViewModel.cs deleted file mode 100644 index 3e7f6b8413..0000000000 --- a/MediaBrowser.UI/ViewModels/ItemCollectionViewModel.cs +++ /dev/null @@ -1,158 +0,0 @@ -using MediaBrowser.Model.Dto; -using System; -using System.Threading; -using System.Windows; - -namespace MediaBrowser.UI.ViewModels -{ - /// - /// Represents a view model that contains multiple items. - /// This should be used if you want to display a button or list item that holds more than one item, - /// and cycle through them periodically. - /// - public class ItemCollectionViewModel : BaseViewModel, IDisposable - { - private int RotationPeriodMs { get; set; } - - public ItemCollectionViewModel(int rotationPeriodMs = 10000, int rotationDevaiationMs = 2000) - : base() - { - if (rotationDevaiationMs > 0) - { - rotationPeriodMs += new Random(Guid.NewGuid().GetHashCode()).Next(0 - rotationDevaiationMs, rotationDevaiationMs); - } - - RotationPeriodMs = rotationPeriodMs; - } - - /// - /// Gets the timer that updates the current item - /// - private Timer CurrentItemTimer { get; set; } - - private string _name; - /// - /// Gets or sets the name of the collection - /// - public string Name - { - get { return _name; } - set - { - _name = value; - OnPropertyChanged("Name"); - } - } - - private BaseItemDto[] _items; - /// - /// Gets or sets the list of items - /// - public BaseItemDto[] Items - { - get { return _items; } - set - { - _items = value ?? new BaseItemDto[] { }; - OnPropertyChanged("Items"); - CurrentItemIndex = Items.Length == 0 ? -1 : 0; - - ReloadTimer(); - } - } - - private int _currentItemIndex; - /// - /// Gets or sets the index of the current item - /// - public int CurrentItemIndex - { - get { return _currentItemIndex; } - set - { - _currentItemIndex = value; - OnPropertyChanged("CurrentItemIndex"); - OnPropertyChanged("CurrentItem"); - OnPropertyChanged("NextItem"); - } - } - - /// - /// Gets the current item - /// - public BaseItemDto CurrentItem - { - get { return CurrentItemIndex == -1 ? null : Items[CurrentItemIndex]; } - } - - /// - /// Gets the next item - /// - public BaseItemDto NextItem - { - get - { - if (CurrentItem == null || CurrentItemIndex == -1) - { - return null; - } - var index = CurrentItemIndex + 1; - - if (index >= Items.Length) - { - index = 0; - } - - return Items[index]; - } - } - - /// - /// Disposes the timer - /// - private void DisposeTimer() - { - if (CurrentItemTimer != null) - { - CurrentItemTimer.Dispose(); - } - } - - /// - /// Reloads the timer - /// - private void ReloadTimer() - { - DisposeTimer(); - - // Don't bother unless there's at least two items - if (Items.Length > 1) - { - CurrentItemTimer = new Timer(state => Application.Current.Dispatcher.InvokeAsync(IncrementCurrentItemIndex), null, RotationPeriodMs, RotationPeriodMs); - } - } - - /// - /// Increments current item index, or resets it back to zero if we're at the end of the list - /// - private void IncrementCurrentItemIndex() - { - var newIndex = CurrentItemIndex + 1; - - if (newIndex >= Items.Length) - { - newIndex = 0; - } - - CurrentItemIndex = newIndex; - } - - /// - /// Disposes the collection - /// - public void Dispose() - { - DisposeTimer(); - } - } -} diff --git a/MediaBrowser.UI/ViewModels/SpecialFeatureViewModel.cs b/MediaBrowser.UI/ViewModels/SpecialFeatureViewModel.cs deleted file mode 100644 index f6d51d6dbf..0000000000 --- a/MediaBrowser.UI/ViewModels/SpecialFeatureViewModel.cs +++ /dev/null @@ -1,135 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Net; -using System; -using System.Windows.Media.Imaging; - -namespace MediaBrowser.UI.ViewModels -{ - /// - /// Class SpecialFeatureViewModel - /// - public class SpecialFeatureViewModel : BaseViewModel - { - /// - /// Gets or sets the image download options. - /// - /// The image download options. - public ImageOptions ImageDownloadOptions { get; set; } - - /// - /// The _image width - /// - private double _imageWidth; - /// - /// Gets or sets the width of the image. - /// - /// The width of the image. - public double ImageWidth - { - get { return _imageWidth; } - - set - { - _imageWidth = value; - OnPropertyChanged("ImageWidth"); - } - } - - /// - /// The _image height - /// - private double _imageHeight; - /// - /// Gets or sets the height of the image. - /// - /// The height of the image. - public double ImageHeight - { - get { return _imageHeight; } - - set - { - _imageHeight = value; - OnPropertyChanged("ImageHeight"); - } - } - - /// - /// The _item - /// - private BaseItemDto _item; - /// - /// Gets or sets the item. - /// - /// The item. - public BaseItemDto Item - { - get { return _item; } - - set - { - _item = value; - OnPropertyChanged("Item"); - OnItemChanged(); - } - } - - /// - /// Gets the time string. - /// - /// The time string. - public string MinutesString - { - get - { - var time = TimeSpan.FromTicks(Item.RunTimeTicks ?? 0); - - var minutes = Math.Round(time.TotalMinutes); - - if (minutes <= 1) - { - return "1 minute"; - } - - return string.Format("{0} minutes", minutes); - } - } - - /// - /// The _image - /// - private BitmapImage _image; - /// - /// Gets the image. - /// - /// The image. - public BitmapImage Image - { - get { return _image; } - set - { - _image = value; - OnPropertyChanged("Image"); - } - } - - /// - /// Called when [item changed]. - /// - private async void OnItemChanged() - { - var options = ImageDownloadOptions ?? new ImageOptions { }; - - options.ImageType = ImageType.Primary; - - try - { - Image = await App.Instance.GetRemoteBitmapAsync(App.Instance.ApiClient.GetImageUrl(Item, options)); - } - catch (HttpException) - { - } - } - } -} diff --git a/MediaBrowser.UI/packages.config b/MediaBrowser.UI/packages.config deleted file mode 100644 index 3de1bc355b..0000000000 --- a/MediaBrowser.UI/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.UI/plugins/codec/libavcodec_plugin.dll.REMOVED.git-id b/MediaBrowser.UI/plugins/codec/libavcodec_plugin.dll.REMOVED.git-id deleted file mode 100644 index 8aaa732062..0000000000 --- a/MediaBrowser.UI/plugins/codec/libavcodec_plugin.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -b4c5b79372014383488c16e359974e2fbbae5a89 \ No newline at end of file diff --git a/MediaBrowser.UI/plugins/gui/libqt4_plugin.dll.REMOVED.git-id b/MediaBrowser.UI/plugins/gui/libqt4_plugin.dll.REMOVED.git-id deleted file mode 100644 index c1c323a92d..0000000000 --- a/MediaBrowser.UI/plugins/gui/libqt4_plugin.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -a70729e8d25a1f2260a18d4cb0e202895d6df263 \ No newline at end of file