2012-08-05 01:54:00 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows;
|
2012-08-05 04:44:08 +02:00
|
|
|
|
using Microsoft.Shell;
|
2012-08-05 03:13:32 +02:00
|
|
|
|
using MediaBrowser.Controller;
|
2012-08-05 01:54:00 +02:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.ServerApplication
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for App.xaml
|
|
|
|
|
/// </summary>
|
2012-08-05 04:44:08 +02:00
|
|
|
|
public partial class App : Application, ISingleInstanceApp
|
2012-08-05 01:54:00 +02:00
|
|
|
|
{
|
2012-08-05 04:44:08 +02:00
|
|
|
|
private const string Unique = "MediaBrowser3";
|
|
|
|
|
|
|
|
|
|
[STAThread]
|
|
|
|
|
public static void Main()
|
|
|
|
|
{
|
|
|
|
|
if (SingleInstance<App>.InitializeAsFirstInstance(Unique))
|
|
|
|
|
{
|
|
|
|
|
var application = new App();
|
|
|
|
|
application.InitializeComponent();
|
|
|
|
|
application.Run();
|
|
|
|
|
// Allow single instance code to perform cleanup operations
|
|
|
|
|
SingleInstance<App>.Cleanup();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region ISingleInstanceApp Members
|
|
|
|
|
public bool SignalExternalCommandLineArgs(IList<string> args)
|
|
|
|
|
{
|
|
|
|
|
// handle command line arguments of second instance
|
|
|
|
|
// ...
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
2012-08-05 03:13:32 +02:00
|
|
|
|
protected override void OnExit(ExitEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnExit(e);
|
|
|
|
|
|
|
|
|
|
Kernel.Instance.Dispose();
|
|
|
|
|
}
|
2012-08-05 01:54:00 +02:00
|
|
|
|
}
|
|
|
|
|
}
|