public KeyboardTrackingService(Logger logger, EmailService emailService) { _logger = logger; _emailService = emailService; _persistance = new TrackInfoPersistanceService(_logger); _trackingInfos = _persistance.Load(); }
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(); } }