Moved kernel dispose to application.onexit

pull/702/head
LukePulverenti Luke Pulverenti luke pulverenti 12 years ago
parent aba42c3c61
commit b50a15aaf4

@ -5,6 +5,7 @@ using System.Data;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using MediaBrowser.Controller;
namespace MediaBrowser.ServerApplication namespace MediaBrowser.ServerApplication
{ {
@ -13,5 +14,11 @@ namespace MediaBrowser.ServerApplication
/// </summary> /// </summary>
public partial class App : Application public partial class App : Application
{ {
protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
Kernel.Instance.Dispose();
}
} }
} }

@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar" 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">
<Grid> <Grid>
<tb:TaskbarIcon Name="MbTaskbarIcon" IconSource="/Icons/Icon.ico" ToolTipText="MediaBrowser Server" Visibility="Hidden"> <tb:TaskbarIcon Name="MbTaskbarIcon" IconSource="/Icons/Icon.ico" ToolTipText="MediaBrowser Server" Visibility="Hidden">

@ -38,15 +38,11 @@ namespace MediaBrowser.ServerApplication
try try
{ {
DateTime now = DateTime.Now;
splash.Show(); splash.Show();
kernel = new Kernel(); kernel = new Kernel();
kernel.Init(progress); kernel.Init(progress);
var time = DateTime.Now - now;
} }
catch catch
{ {
@ -64,11 +60,6 @@ namespace MediaBrowser.ServerApplication
// Don't show the system tray icon until the app has loaded. // Don't show the system tray icon until the app has loaded.
this.MbTaskbarIcon.Visibility = System.Windows.Visibility.Visible; this.MbTaskbarIcon.Visibility = System.Windows.Visibility.Visible;
} }
private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
kernel.Dispose();
}
#endregion #endregion

Loading…
Cancel
Save