1
0
DerpingDrivers/DerpingDrivers/App.xaml.cs
2018-10-25 14:45:27 +02:00

47 lines
1.4 KiB
C#

using System.Windows;
using ExceptionReporting;
using Microsoft.Win32;
namespace DerpingDrivers
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public App()
{
var netRelease = (int) Registry.GetValue(
@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full",
"Release",
0);
// This is a bit ugly but catches cases where invoked without the app.config
// will lead to a silent crash because of missing methods etc.
if (netRelease < 394254)
{
MessageBox.Show(
"This program requires the .NET Framework v4.6.1 (or higher) to run properly, please install!",
"Missing .NET", MessageBoxButton.OK, MessageBoxImage.Error);
Shutdown(-1);
return;
}
DispatcherUnhandledException += (sender, args) =>
{
var er = new ExceptionReporter
{
Config =
{
AppName = "DerpingDrivers",
SendMethod = ReportSendMethod.None
}
};
er.Show(args.Exception);
args.Handled = true;
Shutdown(-2);
};
}
}
}