public TwitterShareService(TwitterPersistenceService twitterPersistenceService,TweetMessageService tweetMessageService) { _twitterPersistenceService = twitterPersistenceService; _tweetMessageService = tweetMessageService; _logger = LogManager.GetLogger("log"); Authenticate(); }
public void Execute() { _logger = LogManager.GetLogger("log"); try { InitializeLoggingConfiguration(); Application.AddMessageFilter(KeyboardTracking.Instance); SdlTradosStudio.Application.Closing += Application_Closing; _service = new KeyboardTrackingService(_logger); _editorController = SdlTradosStudio.Application.GetController<EditorController>(); _editorController.Opened += _editorController_Opened; _editorController.ActiveDocumentChanged += _editorController_ActiveDocumentChanged; _editorController.Closing += _editorController_Closing; var twitterPersistenceService = new TwitterPersistenceService(_logger); if (twitterPersistenceService.HasAccountConfigured) return; using (var tForm = new TwitterAccountSetup(twitterPersistenceService)) { tForm.ShowDialog(); } } catch (Exception ex) { _logger.Debug(ex,"Unexpected exception when intializing the app"); throw; } }
public void Execute() { _logger = LogManager.GetLogger("log"); try { InitializeLoggingConfiguration(); Application.AddMessageFilter(KeyboardTracking.Instance); SdlTradosStudio.Application.Closing += Application_Closing; _service = new KeyboardTrackingService(_logger); _editorController = SdlTradosStudio.Application.GetController <EditorController>(); _editorController.Opened += _editorController_Opened; _editorController.ActiveDocumentChanged += _editorController_ActiveDocumentChanged; _editorController.Closing += _editorController_Closing; var twitterPersistenceService = new TwitterPersistenceService(_logger); if (twitterPersistenceService.HasAccountConfigured) { return; } using (var tForm = new TwitterAccountSetup(twitterPersistenceService)) { tForm.ShowDialog(); } } catch (Exception ex) { _logger.Debug(ex, "Unexpected exception when intializing the app"); throw; } }
protected override void Execute() { Application.EnableVisualStyles(); var logger = LogManager.GetLogger("log"); try { var twitterPersistenceService = new TwitterPersistenceService(logger); if (!ProductivityUiHelper.IsTwitterAccountConfigured(twitterPersistenceService, logger)) { MessageBox.Show( PluginResources .ProductivityViewPartAction_Execute_You_need_to_configure_the_twitter_account_to_see_your_score); return; } using (var pForm = new ProductivityForm()) { pForm.ShowDialog(); } } catch (Exception ex) { logger.Debug(ex, "Unexpected exception when opening the productivity score"); throw; } }
public TwitterShareService(TwitterPersistenceService twitterPersistenceService, TweetMessageService tweetMessageService) { _twitterPersistenceService = twitterPersistenceService; _tweetMessageService = tweetMessageService; _logger = LogManager.GetLogger("log"); Authenticate(); }
public ShareService(ProductivityService productivityService, TwitterPersistenceService twitterPersistenceService, TweetMessageService tweetMessageService, LeaderboardApi leaderboardApi, Logger logger) { _productivityService = productivityService; _twitterPersistenceService = twitterPersistenceService; _tweetMessageService = tweetMessageService; _leaderboardApi = leaderboardApi; _logger = logger; Initialize(); }
public static bool IsTwitterAccountConfigured(TwitterPersistenceService twitterPersistenceService, Logger logger) { var isTwitterAccountConfigured = true; if (twitterPersistenceService.HasAccountConfigured) return true; using (var tForm = new TwitterAccountSetup(twitterPersistenceService)) { var result = tForm.ShowDialog(); if (result != DialogResult.OK) { isTwitterAccountConfigured = false; } } return isTwitterAccountConfigured; }
public void Execute() { _logger = LogManager.GetLogger("log"); #if DEBUG { _emailService = new EmailService(true); } #else { _emailService = new EmailService(false); } #endif try { RavenContext.Current.Initialize(); InitializeLoggingConfiguration(); Application.AddMessageFilter(KeyboardTracking.Instance); SdlTradosStudio.Application.Closing += Application_Closing; _service = new KeyboardTrackingService(_logger, _emailService); _editorController = SdlTradosStudio.Application.GetController <EditorController>(); _editorController.Opened += _editorController_Opened; _editorController.ActiveDocumentChanged += _editorController_ActiveDocumentChanged; _editorController.Closing += _editorController_Closing; var twitterPersistenceService = new TwitterPersistenceService(_logger); if (twitterPersistenceService.HasAccountConfigured) { return; } using (var tForm = new TwitterAccountSetup(twitterPersistenceService)) { tForm.ShowDialog(); } _logger.Info(string.Format("Started productivity plugin version {0}", VersioningService.GetPluginVersion())); } catch (Exception ex) { _logger.Debug(ex, "Unexpected exception when intializing the app"); _emailService.SendLogFile(); } }
public static bool IsTwitterAccountConfigured(TwitterPersistenceService twitterPersistenceService, Logger logger) { var isTwitterAccountConfigured = true; if (twitterPersistenceService.HasAccountConfigured) { return(true); } using (var tForm = new TwitterAccountSetup(twitterPersistenceService)) { var result = tForm.ShowDialog(); if (result != DialogResult.OK) { isTwitterAccountConfigured = false; } } return(isTwitterAccountConfigured); }
protected override void Execute() { Application.EnableVisualStyles(); var logger = LogManager.GetLogger("log"); try { var twitterPersistenceService = new TwitterPersistenceService(logger); var leaderboardApi = new LeaderboardApi(twitterPersistenceService); var tweetMessageService = new TweetMessageService(); if (!ProductivityUiHelper.IsTwitterAccountConfigured(twitterPersistenceService, logger)) { MessageBox.Show( PluginResources .ProductivityShareViewPartAction_Execute_In_order_to_share_the_result_you_need_to_configure_your_twitter_account); return; } var productivityService = new ProductivityService(logger); if (productivityService.TotalNumberOfCharacters < Constants.MinimumNumberOfCharacters) { MessageBox.Show( string.Format( PluginResources .ProductivityShareViewPartAction_Execute_In_order_to_share_your_score_you_need_to_translate_at_least__0__characters, Constants.MinimumNumberOfCharacters.ToString("N0"))); return; } var shareService = new ShareService(productivityService, twitterPersistenceService, tweetMessageService, leaderboardApi, logger); using (var tf = new TweetForm(shareService)) { tf.ShowDialog(); } } catch (Exception ex) { logger.Debug(ex, "Unexpected exception when opening the share score"); throw; } }
public void Execute() { _logger = LogManager.GetLogger("log"); #if DEBUG { _emailService = new EmailService(true); } #else { _emailService = new EmailService(false); } #endif try { InitializeLoggingConfiguration(); Application.AddMessageFilter(KeyboardTracking.Instance); SdlTradosStudio.Application.Closing += Application_Closing; _service = new KeyboardTrackingService(_logger,_emailService); _editorController = SdlTradosStudio.Application.GetController<EditorController>(); _editorController.Opened += _editorController_Opened; _editorController.ActiveDocumentChanged += _editorController_ActiveDocumentChanged; _editorController.Closing += _editorController_Closing; var twitterPersistenceService = new TwitterPersistenceService(_logger); if (twitterPersistenceService.HasAccountConfigured) return; using (var tForm = new TwitterAccountSetup(twitterPersistenceService)) { tForm.ShowDialog(); } _logger.Info(string.Format("Started productivity plugin version {0}",VersioningService.GetPluginVersion())); } catch (Exception ex) { _logger.Debug(ex,"Unexpected exception when intializing the app"); _emailService.SendLogFile(); } }
public static void CreateProductivityForm(Logger logger) { try { var productivityService = new ProductivityService(logger); var twitterPersistanceService = new TwitterPersistenceService(logger); var leaderboardApi = new LeaderboardApi(twitterPersistanceService); var versioningService = new VersioningService(leaderboardApi); var tweetMessageService = new TweetMessageService(versioningService); var twitterShareService = new TwitterShareService(twitterPersistanceService, tweetMessageService); using (var pForm = new ProductivityForm(productivityService, twitterShareService)) { pForm.ShowDialog(); } } catch (Exception ex) { logger.Debug(ex, "Unexpected exception when opening the productivity score"); throw; } }
public LeaderboardShareService(LeaderboardApi leaderboardApi, TwitterPersistenceService twitterPersistenceService) { _leaderboardApi = leaderboardApi; _twitterAccountInfo = twitterPersistenceService.Load(); }
public TwitterAccountSetup(TwitterPersistenceService twitterPersistenceService) { InitializeComponent(); _twitterPersistenceService = twitterPersistenceService; }
public static void CreateTweetForm(Logger logger) { try { var twitterPersistenceService = new TwitterPersistenceService(logger); if (!ProductivityUiHelper.IsTwitterAccountConfigured(twitterPersistenceService, logger)) { MessageBox.Show( PluginResources .ProductivityShareViewPartAction_Execute_In_order_to_share_the_result_you_need_to_configure_your_twitter_account); return; } var productivityService = new ProductivityService(logger); if (productivityService.TotalNumberOfCharacters < Constants.MinimumNumberOfCharacters) { MessageBox.Show( string.Format( PluginResources .ProductivityShareViewPartAction_Execute_In_order_to_share_your_score_you_need_to_translate_at_least__0__characters, Constants.MinimumNumberOfCharacters.ToString("N0"))); return; } var leaderboardApi = new LeaderboardApi(twitterPersistenceService); var versioningService = new VersioningService(leaderboardApi); var tweetMessageService = new TweetMessageService(versioningService); var leaderBoardShareService = new LeaderboardShareService(leaderboardApi, twitterPersistenceService); var twitterShareService = new TwitterShareService(twitterPersistenceService, tweetMessageService); var shareService = new ShareService(productivityService, twitterShareService, leaderBoardShareService, versioningService); if (!leaderboardApi.IsAlive()) { MessageBox.Show(PluginResources.TweetFactory_CreateTweet_SDL_Leaderboard_could_not_be_reached__Please_check_your_internet_connectivity_and_try_again); return; } if (!twitterShareService.IsAlive()) { MessageBox.Show(PluginResources.TweetFactory_CreateTweet_Twitter_could_not_be_reached__Please_check_your_internet_connectivity_and_try_again_); return; } if (!versioningService.IsPluginVersionCompatibleWithLeaderboardVersion()) { MessageBox.Show( string.Format( "In order to share you score you need to update the plugin to the version {0}. Please download the latest version from Open Exchange.", shareService.LeaderboardVersion)); return; } using (var tf = new TweetForm(shareService,tweetMessageService, productivityService)) { tf.ShowDialog(); } } catch (Exception ex) { logger.Debug(ex, "Unexpected exception when opening the share score"); throw; } }
public LeaderboardApi(TwitterPersistenceService twitterPersistence) { _numberOfRetries = 0; _twitterAccountInfo = twitterPersistence.Load(); _logger = LogManager.GetLogger("log"); }
public LeaderboardApi(TwitterPersistenceService twitterPersistence) { _numberOfRetries = 0; _twitterAccountInfo = twitterPersistence.Load(); }
public static void CreateTweetForm(Logger logger) { try { var twitterPersistenceService = new TwitterPersistenceService(logger); if (!ProductivityUiHelper.IsTwitterAccountConfigured(twitterPersistenceService, logger)) { MessageBox.Show( PluginResources .ProductivityShareViewPartAction_Execute_In_order_to_share_the_result_you_need_to_configure_your_twitter_account); return; } var productivityService = new ProductivityService(logger); if (productivityService.TotalNumberOfCharacters < Constants.MinimumNumberOfCharacters) { MessageBox.Show( string.Format( PluginResources .ProductivityShareViewPartAction_Execute_In_order_to_share_your_score_you_need_to_translate_at_least__0__characters, Constants.MinimumNumberOfCharacters.ToString("N0"))); return; } var leaderboardApi = new LeaderboardApi(twitterPersistenceService); var versioningService = new VersioningService(leaderboardApi); var tweetMessageService = new TweetMessageService(versioningService); var leaderBoardShareService = new LeaderboardShareService(leaderboardApi, twitterPersistenceService); var twitterShareService = new TwitterShareService(twitterPersistenceService, tweetMessageService); var shareService = new ShareService(productivityService, twitterShareService, leaderBoardShareService, versioningService); if (!leaderboardApi.IsAlive()) { MessageBox.Show(PluginResources.TweetFactory_CreateTweet_SDL_Leaderboard_could_not_be_reached__Please_check_your_internet_connectivity_and_try_again); return; } if (!twitterShareService.IsAlive()) { MessageBox.Show(PluginResources.TweetFactory_CreateTweet_Twitter_could_not_be_reached__Please_check_your_internet_connectivity_and_try_again_); return; } if (!versioningService.IsPluginVersionCompatibleWithLeaderboardVersion()) { MessageBox.Show( string.Format( "In order to share you score you need to update the plugin to the version {0}. Please download the latest version from Open Exchange.", shareService.LeaderboardVersion)); return; } using (var tf = new TweetForm(shareService, tweetMessageService, productivityService)) { tf.ShowDialog(); } } catch (Exception ex) { logger.Debug(ex, "Unexpected exception when opening the share score"); throw; } }