show general error
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls.Primitives;
|
||||||
using TV_Player.ViewModels;
|
using TV_Player.ViewModels;
|
||||||
|
|
||||||
namespace TV_Player
|
namespace TV_Player
|
||||||
@@ -9,13 +10,32 @@ namespace TV_Player
|
|||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
private TVPlayerViewModel _tvPlayer;
|
private TVPlayerViewModel _tvPlayer;
|
||||||
|
|
||||||
|
private const string Guid = "250C5597-BA73-40DF-B2CF-DD644F044834";
|
||||||
|
static readonly Mutex Mutex = new Mutex(true, "{" + Guid + "}");
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
{
|
{
|
||||||
|
AppDomain.CurrentDomain.UnhandledException += ReportAndRestart;
|
||||||
|
|
||||||
|
if (!Mutex.WaitOne(TimeSpan.Zero, true))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Programm already running");
|
||||||
|
Current.Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
_tvPlayer = new TVPlayerViewModel();
|
_tvPlayer = new TVPlayerViewModel();
|
||||||
|
|
||||||
base.OnStartup(e);
|
base.OnStartup(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void ReportAndRestart(object sender, UnhandledExceptionEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
string info = e.ExceptionObject.ToString();
|
||||||
|
MessageBox.Show(info,"Application");
|
||||||
|
|
||||||
|
Environment.Exit(1);
|
||||||
|
}
|
||||||
protected override void OnExit(ExitEventArgs e)
|
protected override void OnExit(ExitEventArgs e)
|
||||||
{
|
{
|
||||||
_tvPlayer = null;
|
_tvPlayer = null;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="LibVLCSharp.WPF" Version="3.8.2" />
|
<PackageReference Include="LibVLCSharp.WPF" Version="3.8.2" />
|
||||||
<PackageReference Include="System.Reactive" Version="6.0.0" />
|
<PackageReference Include="System.Reactive" Version="6.0.0" />
|
||||||
|
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.20" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user