private XElement TryGetChildElement(XElement parent, string childName)
 {
     try
     {
         var element = parent.Element(childName);
         if (element == null)
         {
             throw new Exception("XML element " + parent.Name + "." + childName + " is null");
         }
         return(element);
     }
     catch (Exception ex)
     {
         _debugLogger.GetLogger(1).Log("Не удалось найти XML элемент " + parent.Name + "." + childName,
                                       new StackTrace(ex, true));
         throw;
     }
 }
Пример #2
0
 public EngineSettingsReader(ICommandSenderHost commandSenderHost, ITargetAddressHost targerAddressHost,
                             ILogger logger,
                             IEngineSettingsStorageSettable settingsStorageSettable, IMultiLoggerWithStackTrace <int> debugLogger)
 {
     _commandSenderHost       = commandSenderHost;
     _targerAddressHost       = targerAddressHost;
     _logger                  = logger;
     _settingsStorageSettable = settingsStorageSettable;
     _readSettingsTimeout     = TimeSpan.FromMilliseconds(200.0);
     _notifyWorker            = new SingleThreadedRelayQueueWorker <Action>("EngineSettingsReaderNotify", a => a(),
                                                                            ThreadPriority.BelowNormal, true, null, debugLogger.GetLogger(0));
 }
        public CoolerTelemetriesViewModel(ICommandSenderHost commandSenderHost, ITargetAddressHost targerAddressHost,
                                          IUserInterfaceRoot userInterfaceRoot, ILogger logger, IMultiLoggerWithStackTrace <int> debugLogger,
                                          IWindowSystem windowSystem)
        {
            _commandSenderHost = commandSenderHost;
            _targerAddressHost = targerAddressHost;
            _userInterfaceRoot = userInterfaceRoot;
            _logger            = logger;
            _debugLogger       = debugLogger;
            _windowSystem      = windowSystem;

            _readCycleCommand   = new RelayCommand(ReadCycle, () => !_readingInProgress);
            _stopReadingCommand = new RelayCommand(StopReading, () => _readingInProgress);

            CoolerTelemetryVm = new CoolerTelemetryViewModel();

            _backWorker = new SingleThreadedRelayQueueWorker <Action>("CoolerTelemetryBackWorker", a => a(),
                                                                      ThreadPriority.BelowNormal, true, null, _debugLogger.GetLogger(0));
            _syncCancel        = new object();
            _cancel            = false;
            _readingInProgress = false;
        }