Esempio n. 1
0
        public IIntegralData GetIntegralData(string objectName, DateTime upToTime)
        {
            IIntegralData result = null;
            Exception     exc    = null;

            _queueWorker.AddToQueueAndWaitExecution(() => {
                try {
                    result = _storage.GetIntegralData(objectName, upToTime);
                }
                catch (Exception ex) {
                    exc = ex;
                }
            });
            if (exc != null)
            {
                throw exc;
            }
            return(result);
        }
Esempio n. 2
0
        public void Update(IPsnConfiguration psnConfig, string customName)
        {
            // TODO: improve threading
            // Предполагается, что метод вызывается из потока UI

            _psnConfiguration = psnConfig;

            _psnDataCustomConfigration.SetPsnConfigurationId(new IdentifierStringToLowerBased(_psnConfiguration.Id.ToString().ToLower()));
            _psnDataCustomConfigration.SetCustomLogName(customName);

            _bworker.AddToQueueAndWaitExecution(() => {
                _psnDataCustomConfigurationStorage.Update(_psnDataCustomConfigration.Id, new IdentifierStringToLowerBased(_psnConfiguration.Id.ToString().ToLower()), customName);
                _psnConfigurationLowLevel = _psnProtocolStorage.StoredItems.First(lowConfig => lowConfig.Id.IdentyString == _psnConfiguration.Id.ToString().ToLower());
            });

            RebuildMetersUnsafe();
        }
Esempio n. 3
0
        public void SetName(string name)
        {
            _name = name;
            Exception exc = null;

            _backWorker.AddToQueueAndWaitExecution(
                () => {
                try {
                    // Сперва получаем данные из хранилища, т.к. не знаем названия локомотива
                    var devInfo = _backStorage.DeviceInformations.First(di => di.Id.ToString() == _deviceInformationId.ToString());
                    _backStorage.Update(new IdentifierStringToLowerBased(_deviceInformationId.UnicString), devInfo.Name, name);
                }
                catch (Exception ex) {
                    exc = ex;
                }
            });
            if (exc != null)
            {
                throw exc;
            }
        }
 public void SetName(string name)
 {
     Name = name;
     foreach (var section in Sections)
     {
         var       sectionName = section.Name;
         var       devId       = section.DeviceInformationId;
         Exception exc         = null;
         _backWorker.AddToQueueAndWaitExecution(() => {
             try {
                 _backSotrage.Update(new IdentifierStringToLowerBased(devId.UnicString), name, sectionName);
             }
             catch (Exception ex) {
                 exc = ex;
             }
         });
         if (exc != null)
         {
             throw exc;
         }
     }
 }