private void Application_Startup(object sender, StartupEventArgs e) { ConfigurationItemFactory.Default.Targets .RegisterDefinition("UserInfoLogger", typeof(ESLTracker.Utils.NLog.UserInfoLoggerTarget)); AppDomain.CurrentDomain.UnhandledException += (s, ex) => HandleUnhandledException((Exception)ex.ExceptionObject, "AppDomain.CurrentDomain.UnhandledException"); DispatcherUnhandledException += (s, ex) => HandleUnhandledException(ex.Exception, "Application.Current.DispatcherUnhandledException"); TaskScheduler.UnobservedTaskException += (s, ex) => HandleUnhandledException(ex.Exception, "TaskScheduler.UnobservedTaskException"); CheckSingleInstance(); CheckDataFile(); IVersionService vc = TrackerFactory.DefaultTrackerFactory.GetService <IVersionService>(); var settings = TrackerFactory.DefaultTrackerFactory.GetService <ISettings>(); var newVersion = vc.CheckNewAppVersionAvailable(); if (newVersion.IsAvailable) { Logger userInfo = LogManager.GetLogger(App.UserInfoLogger); userInfo.Info(NewVersionAvailable, new Dictionary <string, string> { { OpenChangelog, settings.VersionCheck_LatestBuildUserUrl }, { Download, newVersion.DownloadUrl } }); } if (vc.IsNewCardsDBAvailable()) { ICardsDatabase cardsDB = vc.GetLatestCardsDB(); Logger log = LogManager.GetLogger(App.UserInfoLogger); log.Info(CardsDatabaseUpdated, new object[] { cardsDB.Version, cardsDB.VersionDate.ToShortDateString(), cardsDB.VersionInfo }); } bool isShiftPressed = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift; if (settings.General_StartGameWithTracker && !isShiftPressed) { var winApi = TrackerFactory.DefaultTrackerFactory.GetService <IWinAPI>(); var messanger = TrackerFactory.DefaultTrackerFactory.GetService <IMessenger>(); TrackerFactory.DefaultTrackerFactory.GetService <ILauncherService>().StartGame(winApi, messanger); } }
private void Application_Startup(object sender, StartupEventArgs e) { AppDomain.CurrentDomain.UnhandledException += (s, ex) => HandleUnhandledException((Exception)ex.ExceptionObject, "AppDomain.CurrentDomain.UnhandledException"); DispatcherUnhandledException += (s, ex) => HandleUnhandledException(ex.Exception, "Application.Current.DispatcherUnhandledException"); TaskScheduler.UnobservedTaskException += (s, ex) => HandleUnhandledException(ex.Exception, "TaskScheduler.UnobservedTaskException"); CheckSingleInstance(); CheckDataFile(); IVersionService vc = TrackerFactory.DefaultTrackerFactory.GetService <IVersionService>(); if (vc.IsNewCardsDBAvailable()) { vc.GetLatestCardsDB(); } }