Exemplo n.º 1
0
        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 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 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);
        }
Exemplo n.º 4
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();
            }
        }