protected override void OnStartup(StartupEventArgs e) { log4net.LogManager.GetLogger(typeof(App)).Info("Starting application..."); App.Current.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown; if (!CheckLicese()) { Application.Current.Shutdown(); return; } try { string logPath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "logs"); Utility.EnsureFloderWritable(logPath); } catch { var interaction = DependencyInjection.Container.Resolve <IInteractionService>(); interaction.ShowError("Please make sure the logs folder is writable, otherwise logging will not work.", null); } GlobalCommands.ApplyTheme("Windows8"); GlobalCommands.RefreshLanguage(new CultureInfo("en")); // set exception handler Application.Current.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); // set DataDirectory AppDomain.CurrentDomain.SetData("DataDirectory", AppDomain.CurrentDomain.BaseDirectory); App.Current.ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose; base.OnStartup(e); Bootstrapper bootstrapper = new Bootstrapper(); bootstrapper.Run(); }