Exemple #1
0
 public void Setup(EventWatcherManager eventWatcherManager, RequestEvaluatorManager requestEvaluator)
 {
     _evaluator                   = requestEvaluator;
     _eventWatcherManager         = eventWatcherManager;
     _focusChangeWatcher          = _eventWatcherManager.GetWatcher(new AppFocusSocket(new Always <string>(true), new Always <string>(true)));
     _titleChangeWatcher          = _eventWatcherManager.GetWatcher(new AppTitleSocket(new Always <string>(true), new Always <string>(true)));
     _focusChangeWatcher.OnEvent += _focusChangeWatcher_OnEvent;
     _titleChangeWatcher.OnEvent += _titleChangeWatcher_OnEvent;;
 }
        private void SetupStartTasks()
        {
            foreach (var startTrigger in _startTriggers)
            {
                startTrigger.Setup(_evaluator);
                var eventWatcher = _eventWatcherManager.GetWatcher(startTrigger.EventSocket);
                eventWatcher.OnEvent += (s, e) =>
                {
                    if (!startTrigger.IsTriggered(e) || _startTime != DateTime.MinValue)
                    {
                        return;
                    }

                    _startTime = DateTime.Now;
                };
            }
        }