From 30d6e2cd6ce0702faaec73b7ffb59d9844fb6967 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 15 Apr 2013 11:10:12 -0400 Subject: made library scan a bit more conservative --- .../Controls/MultiItemUpdateNotification.xaml.cs | 151 --------------------- 1 file changed, 151 deletions(-) delete mode 100644 MediaBrowser.ServerApplication/Controls/MultiItemUpdateNotification.xaml.cs (limited to 'MediaBrowser.ServerApplication/Controls/MultiItemUpdateNotification.xaml.cs') diff --git a/MediaBrowser.ServerApplication/Controls/MultiItemUpdateNotification.xaml.cs b/MediaBrowser.ServerApplication/Controls/MultiItemUpdateNotification.xaml.cs deleted file mode 100644 index 9d58c0227..000000000 --- a/MediaBrowser.ServerApplication/Controls/MultiItemUpdateNotification.xaml.cs +++ /dev/null @@ -1,151 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Logging; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; - -namespace MediaBrowser.ServerApplication.Controls -{ - /// - /// Interaction logic for MultiItemUpdateNotification.xaml - /// - public partial class MultiItemUpdateNotification : UserControl - { - /// - /// The logger - /// - private readonly ILogger Logger; - - /// - /// Gets the children changed event args. - /// - /// The children changed event args. - private List Items - { - get { return DataContext as List; } - } - - /// - /// Initializes a new instance of the class. - /// - public MultiItemUpdateNotification(ILogger logger) - { - if (logger == null) - { - throw new ArgumentNullException("logger"); - } - - Logger = logger; - - InitializeComponent(); - - Loaded += MultiItemUpdateNotification_Loaded; - } - - /// - /// Handles the Loaded event of the MultiItemUpdateNotification control. - /// - /// The source of the event. - /// The instance containing the event data. - void MultiItemUpdateNotification_Loaded(object sender, RoutedEventArgs e) - { - header.Text = string.Format("{0} New Items!", Items.Count); - - PopulateItems(); - } - - /// - /// Populates the items. - /// - private void PopulateItems() - { - itemsPanel.Children.Clear(); - - var items = Items; - - const int maxItemsToDisplay = 8; - var index = 0; - - foreach (var item in items) - { - if (index >= maxItemsToDisplay) - { - break; - } - - // Try our best to find an image - var path = GetImagePath(item); - - if (string.IsNullOrEmpty(path)) - { - continue; - } - - Image img; - - try - { - img = App.Instance.GetImage(path); - } - catch (FileNotFoundException) - { - Logger.Error("Image file not found {0}", path); - continue; - } - - img.Stretch = Stretch.Uniform; - img.Margin = new Thickness(0, 0, 5, 5); - img.ToolTip = ItemUpdateNotification.GetDisplayName(item, true); - RenderOptions.SetBitmapScalingMode(img, BitmapScalingMode.Fant); - itemsPanel.Children.Add(img); - - index++; - } - } - - - - /// - /// Gets the image path. - /// - /// The item. - /// System.String. - internal static string GetImagePath(BaseItem item) - { - // Try our best to find an image - var path = item.PrimaryImagePath; - - if (string.IsNullOrEmpty(path) && item.BackdropImagePaths != null) - { - path = item.BackdropImagePaths.FirstOrDefault(); - } - - if (string.IsNullOrEmpty(path)) - { - path = item.GetImage(ImageType.Thumb); - } - - if (string.IsNullOrEmpty(path)) - { - path = item.GetImage(ImageType.Art); - } - - if (string.IsNullOrEmpty(path)) - { - path = item.GetImage(ImageType.Logo); - } - - if (string.IsNullOrEmpty(path)) - { - path = item.GetImage(ImageType.Disc); - } - - return path; - } - } -} -- cgit v1.2.3