Radarr/src/NzbDrone/WindowsApp.cs

39 lines
1.2 KiB
C#
Raw Normal View History

using System;
using System.Windows.Forms;
2013-08-30 22:55:01 +00:00
using NLog;
using NzbDrone.Common.EnvironmentInfo;
2013-08-31 01:42:30 +00:00
using NzbDrone.Common.Instrumentation;
using NzbDrone.Host;
using NzbDrone.SysTray;
namespace NzbDrone
{
public static class WindowsApp
{
2014-12-17 07:12:26 +00:00
private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(WindowsApp));
2013-08-30 22:55:01 +00:00
public static void Main(string[] args)
{
try
{
2013-11-26 06:53:36 +00:00
var startupArgs = new StartupContext(args);
2013-08-31 01:42:30 +00:00
2014-12-17 07:12:26 +00:00
NzbDroneLogger.Register(startupArgs, false, true);
2013-08-31 01:42:30 +00:00
2013-11-26 06:53:36 +00:00
Bootstrap.Start(startupArgs, new MessageBoxUserAlert(), container =>
{
container.Register<ISystemTrayApp, SystemTrayApp>();
var trayApp = container.Resolve<ISystemTrayApp>();
trayApp.Start();
});
}
catch (Exception e)
{
2016-02-11 21:13:42 +00:00
Logger.Fatal(e, "EPIC FAIL: " + e.Message);
var message = string.Format("{0}: {1}", e.GetType().Name, e.Message);
MessageBox.Show(text: message, buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Error, caption: "Epic Fail!");
}
}
}
2013-08-31 01:42:30 +00:00
}