From b50a15aaf425f8852568f6d324a92a24f82b46d2 Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Sat, 4 Aug 2012 21:13:32 -0400 Subject: [PATCH] Moved kernel dispose to application.onexit --- MediaBrowser.ServerApplication/App.xaml.cs | 7 +++++++ MediaBrowser.ServerApplication/MainWindow.xaml | 2 +- MediaBrowser.ServerApplication/MainWindow.xaml.cs | 9 --------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/MediaBrowser.ServerApplication/App.xaml.cs b/MediaBrowser.ServerApplication/App.xaml.cs index 83740f3330..8ec51848a0 100644 --- a/MediaBrowser.ServerApplication/App.xaml.cs +++ b/MediaBrowser.ServerApplication/App.xaml.cs @@ -5,6 +5,7 @@ using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; +using MediaBrowser.Controller; namespace MediaBrowser.ServerApplication { @@ -13,5 +14,11 @@ namespace MediaBrowser.ServerApplication /// public partial class App : Application { + protected override void OnExit(ExitEventArgs e) + { + base.OnExit(e); + + Kernel.Instance.Dispose(); + } } } diff --git a/MediaBrowser.ServerApplication/MainWindow.xaml b/MediaBrowser.ServerApplication/MainWindow.xaml index 9b851fae30..35e78424d1 100644 --- a/MediaBrowser.ServerApplication/MainWindow.xaml +++ b/MediaBrowser.ServerApplication/MainWindow.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:tb="http://www.hardcodet.net/taskbar" - Title="MainWindow" Height="350" Width="525" AllowsTransparency="True" Background="Transparent" WindowStyle="None" ShowInTaskbar="False" Closing="MainWindow_Closing" Loaded="MainWindow_Loaded"> + Title="MainWindow" Height="350" Width="525" AllowsTransparency="True" Background="Transparent" WindowStyle="None" ShowInTaskbar="False" Loaded="MainWindow_Loaded"> diff --git a/MediaBrowser.ServerApplication/MainWindow.xaml.cs b/MediaBrowser.ServerApplication/MainWindow.xaml.cs index 688ce19d57..02a6d1be35 100644 --- a/MediaBrowser.ServerApplication/MainWindow.xaml.cs +++ b/MediaBrowser.ServerApplication/MainWindow.xaml.cs @@ -38,15 +38,11 @@ namespace MediaBrowser.ServerApplication try { - DateTime now = DateTime.Now; - splash.Show(); kernel = new Kernel(); kernel.Init(progress); - - var time = DateTime.Now - now; } catch { @@ -64,11 +60,6 @@ namespace MediaBrowser.ServerApplication // Don't show the system tray icon until the app has loaded. this.MbTaskbarIcon.Visibility = System.Windows.Visibility.Visible; } - - private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) - { - kernel.Dispose(); - } #endregion