/// <summary> /// Do any application wide initialization /// </summary> /// <param name="e"></param> protected override void OnStartup(StartupEventArgs e) { #if !DEBUG // setup handler for any unexpected exceptions // unhandled exceptions on the UI thread Application.Current.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(AppDispatcherUnhandledException); // any other unhandled exception AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(AppDomainUnhandledException); #endif // let frame do anything it needs to do base.OnStartup(e); // Initialize embedded assembly loading and complete startup initialization. // Make deploying and sharing easier by supporting the embedding of most // resources/assemblies instead of having many small assemblies without // requiring building as 1 giant assembly. LibZResolver.Startup(() => { // enable Sentry error reporting only when enabled in config file errorTracking = new AppErrorTracking("TRUE".Equals(GetAppSetting("ReportErrors", "True"), StringComparison.InvariantCultureIgnoreCase)); EnableWpfBindingErrors(); IntializeDatabaseRepository(); }); }
private static int Main(string[] args) { try { return(LibZResolver.Startup(() => { var program = new LibZ.Tool.Program(); return program.Run(args); })); } catch (Exception e) { Console.WriteLine("Fatal initialization error"); Console.WriteLine("{0}: {1}", e.GetType().Name, e.Message); Console.WriteLine(e.StackTrace); Console.ReadLine(); return(-1); } }