Example #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            StartupIoC.RegisterIoC(_locator);

            // make sure we're able to do work
            _worker = new WorkerRegistrationController(_locator).EnsureWorkerRegistration();
            _jobRepository = _locator.Locate<IJobRepository>();
            _presenter = new WorkloadPresenter(new WorkloadView());

            var poller = new JobPoller(_presenter, _locator, _worker);

            if (_worker.CurrentJob != Guid.Empty)
            {
                // start working on the job
                _presenter.CurrentJob = JobFactory.CreateJob(_jobRepository.GetCurrentJob(_worker.Id), _worker, _locator);
            }

            poller.Start();

            try
            {
                Application.Run((WorkloadView) _presenter.View);
            }
            finally
            {
                poller.Stop();
            }
        }
Example #2
0
        public JobPoller(WorkloadPresenter presenter, ILocator locator, WorkerState worker, int? intervalSeconds = null)
        {
            _interval = intervalSeconds ?? _interval;

            _presenter = presenter;
            _jobRepository = locator.Locate<IJobRepository>();
            _worker = worker;
            _serviceLocator = locator;
        }