private void ApplicationStartUp(object sender, StartupEventArgs e) { try { Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("ja-JP"); Reactive.Bindings.UIDispatcherScheduler.Initialize(); var settingUtils = new SettingUtils(); var userSetting = settingUtils.getUserSetting(); if (userSetting == null) { if (!settingUtils.CreateUserSetting(out var message)) { throw new Exception(message); } } var imageDir = "./images"; if (!Directory.Exists(imageDir)) { Directory.CreateDirectory(imageDir); } var defaultAccont = userSetting?.UserAccounts?.FirstOrDefault(ua => ua.DefaultAccount); if (defaultAccont != null) { var token = defaultAccont.Token; var tokenSecret = defaultAccont.TokenSecret; Authorization.GetToken(token: token, tokenSecret: tokenSecret); } } catch (Exception exception) { logger.Error(exception.Message); logger.Error(exception.StackTrace); MessageBox.Show("起動に失敗しました"); System.Windows.Application.Current.Shutdown(1); } }