Example #1
0
 public override void Init(SubsystemConfig config)
 {
     _config = (KeyboardManagerConfig) config;
     _keys = new Dictionary<int, KeyConfig>(_config.Keys.Count);
     foreach (KeyConfig key in _config.Keys)
         _keys[key.ScanCode] = key;
     InitKeyboardDriver(_config.Driver);
 }
Example #2
0
 public override void Init(SubsystemConfig config)
 {
     var keyboards = Application.GetSubsystems<IKeyboardManager>();
     foreach (var item in keyboards)
     {
         var keyboard = item.Value;
         if (keyboard is UnionKeyboard)
             continue;
         keyboard.KeyPressed += KeyboardKeyPressed;
     }
 }
Example #3
0
 public override void Init(SubsystemConfig config)
 {
     _config = (ConfigurationManagerConfig)config;
     var keyAttributeNames = new Dictionary<string, string> { { "subsystem", "name" } };
     _mergeUtil = new XmlMerge(_config.PrivateConfigElementXPaths.ToList(), keyAttributeNames);
     _currentConfig = CoreApplication.Instance.Config;
     _currentConfigXml = _currentConfig.ToXml();
     _fileSystemManager = Application.GetSubsystemOrThrow<IFileSystemManager>();
     _electionManager = Application.GetSubsystemOrThrow<IElectionManager>();
     WorkingConfigLoaded = false;
     Application.ConfigUpdated += ApplicationConfigUpdated;
 }
Example #4
0
 public override void ApplyNewConfig(SubsystemConfig newConfig)
 {
 }
Example #5
0
 public override void Init(SubsystemConfig config)
 {
     _config = (PrintingManagerConfig)config;
     _electionManager = Application.GetSubsystemOrThrow<IElectionManager>();
     _votingResultManager = Application.GetSubsystemOrThrow<IVotingResultManager>();
 }
Example #6
0
        public override void Init(SubsystemConfig config)
        {
            _config = (SoundManagerConfig)config;

            InitSoundPlayer();
            InitSoundsPaths();
        }
Example #7
0
 public override void Init(SubsystemConfig config)
 {
     _config = (VotingResultManagerConfig)config;
     _fileSystemManager = Application.GetSubsystemOrThrow<IFileSystemManager>();
     _electionManager = Application.GetSubsystemOrThrow<IElectionManager>();
     _scannersInfo = Application.FindSubsystemImplementsInterfaceOrThrow<IScannersInfo>();
 }
Example #8
0
 public override void ApplyNewConfig(SubsystemConfig newConfig)
 {
     lock (s_loadParametersSync)
     {
         _config = (ScannerManagerConfig)newConfig;
         SelectScannerConfig();
         ResetParametersLoaded();
     }
 }
Example #9
0
 public override void Init(SubsystemConfig config)
 {
     _config = (SynchronizationManagerConfig)config;
     _scannerManager = Application.GetSubsystemOrThrow<IScannerManager>();
     _fileSystemManager = Application.GetSubsystemOrThrow<IFileSystemManager>();
     _electionManager = Application.GetSubsystemOrThrow<IElectionManager>();
     _votingResultManager = Application.GetSubsystemOrThrow<IVotingResultManager>();
     _printingManager = Application.GetSubsystemOrThrow<IPrintingManager>();
     _printingManager.PrintReportStarting += (s, e) => SetPrintReportExecutingNow(true);
     _printingManager.PrintReportFinished += (s, e) => ResetPrintReportExecutingNow(true);
     InitRemoteScannerCommunication();
     InitState();
 }
        protected override ConfigurationElement CreateNewElement()
        {
            string subsystemName     = null;
            string subsystemTypeName = null;
            string traceLevelName    = null;
            string logFileFolder     = null;
            var    separateLog       = false;
            var    disposeOrder      = SubsystemConfig.DISPOSE_ORDER_UNDEFINED;

            for (var go = _reader.MoveToFirstAttribute(); go; go = _reader.MoveToNextAttribute())
            {
                switch (_reader.Name)
                {
                case "name":
                    subsystemName = _reader.Value;
                    break;

                case "type":
                    subsystemTypeName = _reader.Value;
                    break;

                case "traceLevel":
                    traceLevelName = _reader.Value;
                    break;

                case "logFileFolder":
                    logFileFolder = _reader.Value;
                    break;

                case "separateLog":
                    separateLog = bool.Parse(_reader.Value);
                    break;

                case "disposeOrder":
                    disposeOrder = int.Parse(_reader.Value);
                    break;

                default:
                    throw new ConfigurationErrorsException("Неожиданный атрибут: " + _reader.Name, _reader);
                }
            }
            if (string.IsNullOrEmpty(subsystemTypeName))
            {
                throw new ConfigurationErrorsException("Не задано имя типа класса подсистемы в атрибуте type", _reader);
            }
            Type subsystemType;

            try
            {
                subsystemType = Type.GetType(subsystemTypeName, true);
            }
            catch (Exception ex)
            {
                throw new ConfigurationErrorsException("Ошибка получения типа подсистемы: " + subsystemTypeName,
                                                       ex, _reader);
            }
            if (string.IsNullOrEmpty(subsystemName))
            {
                subsystemName = subsystemType.Name;
            }
            var             atts = subsystemType.GetCustomAttributes(typeof(SubsystemConfigurationElementTypeAttribute), true);
            SubsystemConfig configElem;

            if (atts.Length == 0)
            {
                configElem = new SubsystemConfig();
            }
            else
            {
                var att = (SubsystemConfigurationElementTypeAttribute)atts[0];


                try
                {
                    configElem = (SubsystemConfig)Activator.CreateInstance(att.Type);
                }
                catch (Exception ex)
                {
                    throw new ConfigurationErrorsException("Ошибка создания конфигурационного элемента из типа: "
                                                           + att.Type.FullName, ex, _reader);
                }
            }
            configElem.SubsystemName     = subsystemName;
            configElem.SubsystemTypeName = subsystemTypeName;
            configElem.TraceLevelName    = traceLevelName;
            configElem.LogFileFolder     = logFileFolder;
            configElem.SeparateLog       = separateLog;
            configElem.DisposeOrder      = disposeOrder;
            return(configElem);
        }
Example #11
0
 public override void Init(SubsystemConfig config)
 {
     _config = (RecognitionManagerConfig)config;
     _electionManager = Application.GetSubsystemOrThrow<IElectionManager>();
     _votingResultManager = Application.GetSubsystemOrThrow<IVotingResultManager>();
     _scannerManager = Application.GetSubsystemOrThrow<IScannerManager>();
     _fileSystemManager = Application.GetSubsystemOrThrow<IFileSystemManager>();
     CreateOcr();
     GenerateFilePaths();
     _recognitionResultLogger = new RecognitionResultLogger(LogFileFolder);
     RecognitionMode = RecognitionMode.BulletinRecognition;
 }
Example #12
0
 public override void ApplyNewConfig(SubsystemConfig newConfig)
 {
     _config = (RecognitionManagerConfig)newConfig;
     InitRecognition();
 }
Example #13
0
 public override void Init(SubsystemConfig config)
 {
     _config = (ElectionManagerConfig)config;
     _votingResultManager = Application.GetSubsystemOrThrow<IVotingResultManager>();
     _recognitionManager = Application.GetSubsystemOrThrow<IRecognitionManager>();
     _fileSystemManager = Application.GetSubsystemOrThrow<IFileSystemManager>();
     _syncManager = Application.GetSubsystemOrThrow<ISynchronizationManager>();
 }
Example #14
0
 public override void ApplyNewConfig(SubsystemConfig newConfig)
 {
     _config = (ElectionManagerConfig)newConfig;
 }
Example #15
0
 public override void Init(SubsystemConfig config)
 {
     _config = (WorkflowManagerConfig)config;
     _syncManager = Application.GetSubsystemOrThrow<ISynchronizationManager>();
     _fileSystemManager = Application.GetSubsystemOrThrow<IFileSystemManager>();
     _scannerManager = Application.GetSubsystemOrThrow<IScannerManager>();
     StateChanged += (sender, e) => Logger.LogInfo(Message.WorkflowStateChanged, e.State);
     var keyboard = (IKeyboardManager)Application.GetSubsystemOrThrow<UnionKeyboard>();
     keyboard.KeyPressed += LogUserKeyPressed;
     LoadErrorState();
     InitWorkflow();
 }
Example #16
0
 public virtual void Init(SubsystemConfig config)
 {
 }
Example #17
0
 public virtual void ApplyNewConfig(SubsystemConfig newConfig)
 {
 }
        protected override ConfigurationElement CreateNewElement()
        {
            string subsystemName = null;
            string subsystemTypeName = null;
            string traceLevelName = null;
            string logFileFolder = null;
            var separateLog = false;
            var disposeOrder = SubsystemConfig.DISPOSE_ORDER_UNDEFINED;
            for (var go = _reader.MoveToFirstAttribute(); go; go = _reader.MoveToNextAttribute())
            {
                switch (_reader.Name)
                {
                    case "name":
                        subsystemName = _reader.Value;
                        break;
                    case "type":
                        subsystemTypeName = _reader.Value;
                        break;
                    case "traceLevel":
                        traceLevelName = _reader.Value;
                        break;
                    case "logFileFolder":
                        logFileFolder = _reader.Value;
                        break;
                    case "separateLog":
                        separateLog = bool.Parse(_reader.Value);
                        break;
                    case "disposeOrder":
                        disposeOrder = int.Parse(_reader.Value);
                        break;
                    default:
                        throw new ConfigurationErrorsException("Неожиданный атрибут: " + _reader.Name, _reader);
                }
            }
            if (string.IsNullOrEmpty(subsystemTypeName))
                throw new ConfigurationErrorsException("Не задано имя типа класса подсистемы в атрибуте type", _reader);
            Type subsystemType;
            try
            {
                subsystemType = Type.GetType(subsystemTypeName, true);
            }
            catch (Exception ex)
            {
                throw new ConfigurationErrorsException("Ошибка получения типа подсистемы: " + subsystemTypeName,
                    ex, _reader);
            }
            if (string.IsNullOrEmpty(subsystemName))
                subsystemName = subsystemType.Name;
            var atts = subsystemType.GetCustomAttributes(typeof(SubsystemConfigurationElementTypeAttribute), true);
            SubsystemConfig configElem;
            if (atts.Length == 0)
            {
                configElem = new SubsystemConfig();
            }
            else
            {
                var att = (SubsystemConfigurationElementTypeAttribute)atts[0];

                try
                {
                    configElem = (SubsystemConfig)Activator.CreateInstance(att.Type);
                }
                catch (Exception ex)
                {
                    throw new ConfigurationErrorsException("Ошибка создания конфигурационного элемента из типа: "
                        + att.Type.FullName, ex, _reader);
                }
            }
            configElem.SubsystemName = subsystemName;
            configElem.SubsystemTypeName = subsystemTypeName;
            configElem.TraceLevelName = traceLevelName;
            configElem.LogFileFolder = logFileFolder;
            configElem.SeparateLog = separateLog;
            configElem.DisposeOrder = disposeOrder;
            return configElem;
        }
Example #19
0
 public override void Init(SubsystemConfig config)
 {
     _electionManager = Application.GetSubsystemOrThrow<IElectionManager>();
     _votingResultManager = Application.GetSubsystemOrThrow<IVotingResultManager>();
     _recognitionManager = Application.GetSubsystemOrThrow<IRecognitionManager>();
     _sheetProcessingSession = SheetProcessingSession.GetClosedSheetProcessingSession(Logger);
     ApplyNewConfig(config);
 }
Example #20
0
 public override void ApplyNewConfig(SubsystemConfig newConfig)
 {
     _config = (VotingResultManagerConfig)newConfig;
 }