Beispiel #1
0
        private static void UpdateFirstDeviceInfoInStorage(IDeviceInformationStorage storage)
        {
            Log("Попробуем обновить информацию об устройстве");
            var firstDevInfo = storage.DeviceInformations.First();

            storage.Update(firstDevInfo.Id, "Электровоз", "2");
        }
Beispiel #2
0
        public void Update(IIdentifier id, string setName, string setDescription)
        {
            _relayOnStorage.Update(id, setName, setDescription);
            var devInfosToUpdate = _deviceInformations.Where(di => di.Id.IdentyString == id.IdentyString);

            foreach (var devInfo in devInfosToUpdate)
            {
                devInfo.SetName(setName);
                devInfo.SetDescription(setDescription);
            }
        }
Beispiel #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;
         }
     }
 }