public bool Start(HostControl hostControl)
        {
            _hostControl = hostControl;

            if (_status != ServiceStatus.Stopped)
            {
                return(true);
            }
            try
            {
                _imageWatcherFactory.Create(out _imageWatcher, _imageWatcher_EndOfFileEventDetected);
                _imageWatcher.WatchDirectories(MonitoringPaths, ImageExtensions, NewPageTimeOut);

                _settingsExchanger.SubscribeToSettingsSender(GetCurrentServiceSettings, _statusQueueConfig);
                _settingsExchanger.SubscribeToSettingsReceiver(OnReceiveNewSettings, _controlQueueConfig);
            }
            catch
            {
                //log
                hostControl.Stop();
                return(true);
            }

            _status = ServiceStatus.Waiting;

            return(true);
        }
        public bool Start(HostControl hostControl)
        {
            if (_state == ServiceState.Started)
            {
                return(true);
            }

            if (!TryCreateQueues() || !TryCreateConfigFile())
            {
                hostControl.Stop();
                return(true);
            }

            _fileAssembler.StartAssembling(OutputPath, _fileQueueController);

            _settingsExchanger.SubscribeToSettingsSender(GetSettingsFromFile, _controlQueueConfig);
            _settingsExchanger.SubscribeToSettingsReceiver(OnReceiveSettingsFromClients, _statusQueueConfig);

            _state = ServiceState.Started;
            return(true);
        }