public List <IResistor> CreateResistorsOnDevice(IConfiguratedDeviceSchemeTable configuratedDeviceSchemeTable, IRuntimeDevice runtimeDevice) { List <IResistor> resistors = new List <IResistor>(); if (runtimeDevice.StartersOnDevice.Count < 1) { return(resistors); } IEnumerable <IDeviceResistorRow> resistorRowsInDevice = configuratedDeviceSchemeTable.GetResistorEnumerable(); foreach (var resistorRow in resistorRowsInDevice) { IResistor resistor = _container.Resolve <IResistor>(); resistor.ModuleNumber = resistorRow.ResistorModul; resistor.ResistorNumber = resistorRow.ResistorDiskret; if (resistorRow.ParentStarterId != null) { resistor.ParentStarter = runtimeDevice.StartersOnDevice.First((starter => starter.StarterNumber == resistorRow.ParentStarterId)); } resistors.Add(resistor); } return(resistors); }
/// <summary> /// Updates an instance of <see cref="IConfiguratedDeviceSchemeTable"/> in <see cref="IConfigLogicalDevice" /> in the system registry asynchronously /// Асинхронно обновляет схему устройства /// </summary> /// <param name="device">An instance of <see cref="LogicalDeviceInformation" /> to update. /// Устройство в котором будет обновляться схема</param> /// <param name="scheme">New scheme. Instance of <see cref="IConfiguratedDeviceSchemeTable"/> /// Новая схема для устройства</param> /// <returns>An instance of System.Threading.Tasks.Task that represents current asynchronous operation</returns> public async Task UpdateDeviceSchemeAsync(IConfigLogicalDevice device, IConfiguratedDeviceSchemeTable scheme) { var context = await this._persistanceService.GetDevicePersistableContextAsync(device.DeviceId); device.CreateMomento().State.SchemeTable = scheme; context.SaveDeviceMomentoAsync(device.CreateMomento()); }