aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ServerApplication
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.ServerApplication')
-rw-r--r--MediaBrowser.ServerApplication/App.xaml.cs2
-rw-r--r--MediaBrowser.ServerApplication/Controls/ItemUpdateNotification.xaml.cs11
-rw-r--r--MediaBrowser.ServerApplication/Controls/MultiItemUpdateNotification.xaml.cs12
-rw-r--r--MediaBrowser.ServerApplication/LibraryExplorer.xaml.cs11
-rw-r--r--MediaBrowser.ServerApplication/MainWindow.xaml.cs39
5 files changed, 56 insertions, 19 deletions
diff --git a/MediaBrowser.ServerApplication/App.xaml.cs b/MediaBrowser.ServerApplication/App.xaml.cs
index f52a1cbf0..768f5ed11 100644
--- a/MediaBrowser.ServerApplication/App.xaml.cs
+++ b/MediaBrowser.ServerApplication/App.xaml.cs
@@ -179,7 +179,7 @@ namespace MediaBrowser.ServerApplication
/// <returns>Window.</returns>
protected override Window InstantiateMainWindow()
{
- return new MainWindow();
+ return new MainWindow(LogManager.GetLogger("MainWindow"));
}
}
}
diff --git a/MediaBrowser.ServerApplication/Controls/ItemUpdateNotification.xaml.cs b/MediaBrowser.ServerApplication/Controls/ItemUpdateNotification.xaml.cs
index 8cb42f0e5..312e70e66 100644
--- a/MediaBrowser.ServerApplication/Controls/ItemUpdateNotification.xaml.cs
+++ b/MediaBrowser.ServerApplication/Controls/ItemUpdateNotification.xaml.cs
@@ -20,7 +20,7 @@ namespace MediaBrowser.ServerApplication.Controls
/// <summary>
/// The logger
/// </summary>
- private static readonly ILogger Logger = LogManager.GetLogger("MultiItemUpdateNotification");
+ private readonly ILogger Logger;
/// <summary>
/// Gets the children changed event args.
@@ -34,8 +34,15 @@ namespace MediaBrowser.ServerApplication.Controls
/// <summary>
/// Initializes a new instance of the <see cref="ItemUpdateNotification" /> class.
/// </summary>
- public ItemUpdateNotification()
+ public ItemUpdateNotification(ILogger logger)
{
+ if (logger == null)
+ {
+ throw new ArgumentNullException("logger");
+ }
+
+ Logger = logger;
+
InitializeComponent();
Loaded += ItemUpdateNotification_Loaded;
diff --git a/MediaBrowser.ServerApplication/Controls/MultiItemUpdateNotification.xaml.cs b/MediaBrowser.ServerApplication/Controls/MultiItemUpdateNotification.xaml.cs
index 383e4ccbe..bab1958fd 100644
--- a/MediaBrowser.ServerApplication/Controls/MultiItemUpdateNotification.xaml.cs
+++ b/MediaBrowser.ServerApplication/Controls/MultiItemUpdateNotification.xaml.cs
@@ -2,6 +2,7 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -19,7 +20,7 @@ namespace MediaBrowser.ServerApplication.Controls
/// <summary>
/// The logger
/// </summary>
- private static readonly ILogger Logger = LogManager.GetLogger("MultiItemUpdateNotification");
+ private readonly ILogger Logger;
/// <summary>
/// Gets the children changed event args.
@@ -33,8 +34,15 @@ namespace MediaBrowser.ServerApplication.Controls
/// <summary>
/// Initializes a new instance of the <see cref="MultiItemUpdateNotification" /> class.
/// </summary>
- public MultiItemUpdateNotification()
+ public MultiItemUpdateNotification(ILogger logger)
{
+ if (logger == null)
+ {
+ throw new ArgumentNullException("logger");
+ }
+
+ Logger = logger;
+
InitializeComponent();
Loaded += MultiItemUpdateNotification_Loaded;
diff --git a/MediaBrowser.ServerApplication/LibraryExplorer.xaml.cs b/MediaBrowser.ServerApplication/LibraryExplorer.xaml.cs
index 8158b8268..9645b93dc 100644
--- a/MediaBrowser.ServerApplication/LibraryExplorer.xaml.cs
+++ b/MediaBrowser.ServerApplication/LibraryExplorer.xaml.cs
@@ -18,6 +18,7 @@ using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media.Imaging;
+using MediaBrowser.Model.Logging;
namespace MediaBrowser.ServerApplication
{
@@ -26,6 +27,8 @@ namespace MediaBrowser.ServerApplication
/// </summary>
public partial class LibraryExplorer : Window
{
+ private ILogger _logger;
+
/// <summary>
/// The current user
/// </summary>
@@ -33,8 +36,10 @@ namespace MediaBrowser.ServerApplication
/// <summary>
/// Initializes a new instance of the <see cref="LibraryExplorer" /> class.
/// </summary>
- public LibraryExplorer()
+ public LibraryExplorer(ILogger logger)
{
+ _logger = logger;
+
InitializeComponent();
lblVersion.Content = "Version: " + Kernel.Instance.DisplayVersion;
foreach (var user in Kernel.Instance.Users)
@@ -311,7 +316,7 @@ namespace MediaBrowser.ServerApplication
{
using (
new Profiler("Explorer full index expansion for " +
- folder.Name))
+ folder.Name, _logger))
{
//re-build the current item's children as an index
prefs.IndexBy = ddlIndexBy.SelectedItem as string;
@@ -352,7 +357,7 @@ namespace MediaBrowser.ServerApplication
{
using (
new Profiler("Explorer sorting by " + ddlSortBy.SelectedItem + " for " +
- folder.Name))
+ folder.Name, _logger))
{
//re-sort
prefs.SortBy = ddlSortBy.SelectedItem as string;
diff --git a/MediaBrowser.ServerApplication/MainWindow.xaml.cs b/MediaBrowser.ServerApplication/MainWindow.xaml.cs
index 3f0bb1177..bce0c4aa0 100644
--- a/MediaBrowser.ServerApplication/MainWindow.xaml.cs
+++ b/MediaBrowser.ServerApplication/MainWindow.xaml.cs
@@ -2,6 +2,7 @@
using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
+using MediaBrowser.Model.Logging;
using MediaBrowser.ServerApplication.Controls;
using System;
using System.Collections.Generic;
@@ -38,10 +39,24 @@ namespace MediaBrowser.ServerApplication
private Timer NewItemTimer { get; set; }
/// <summary>
+ /// The _logger
+ /// </summary>
+ private readonly ILogger _logger;
+
+ /// <summary>
/// Initializes a new instance of the <see cref="MainWindow" /> class.
/// </summary>
- public MainWindow()
+ /// <param name="logger">The logger.</param>
+ /// <exception cref="System.ArgumentNullException">logger</exception>
+ public MainWindow(ILogger logger)
{
+ if (logger == null)
+ {
+ throw new ArgumentNullException("logger");
+ }
+
+ _logger = logger;
+
InitializeComponent();
Loaded += MainWindowLoaded;
@@ -145,11 +160,19 @@ namespace MediaBrowser.ServerApplication
// Show the notification
if (newItems.Count == 1)
{
- Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new ItemUpdateNotification { DataContext = newItems[0] }, PopupAnimation.Slide, 6000));
+ Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new ItemUpdateNotification(LogManager.GetLogger("ItemUpdateNotification"))
+ {
+ DataContext = newItems[0]
+
+ }, PopupAnimation.Slide, 6000));
}
else if (newItems.Count > 1)
{
- Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new MultiItemUpdateNotification { DataContext = newItems }, PopupAnimation.Slide, 6000));
+ Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new MultiItemUpdateNotification(LogManager.GetLogger("ItemUpdateNotification"))
+ {
+ DataContext = newItems
+
+ }, PopupAnimation.Slide, 6000));
}
}
@@ -246,7 +269,7 @@ namespace MediaBrowser.ServerApplication
}
catch (Exception ex)
{
- Logger.LogException("Error in event handler", ex);
+ _logger.ErrorException("Error in event handler", ex);
}
}
}
@@ -259,7 +282,7 @@ namespace MediaBrowser.ServerApplication
/// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
private void cmOpenExplorer_click(object sender, RoutedEventArgs e)
{
- (new LibraryExplorer()).Show();
+ (new LibraryExplorer(_logger)).Show();
}
/// <summary>
@@ -325,11 +348,5 @@ namespace MediaBrowser.ServerApplication
}
#endregion
-
- private void cmdApiDocs_Click_1(object sender, RoutedEventArgs e)
- {
-
- }
-
}
}