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;
 }
Example #2
0
        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();
            }
        }