/// <summary>
        ///     Sets a deviceViewModel for editing
        ///     Установка устройства для редактирования
        /// </summary>
        /// <param name="deviceModel">Device for editing.</param>
        public async void SetEditingContext(DeviceModel deviceModel, IEnumerable <string> deviceNamesExisting)
        {
            _deviceNamesExisting = deviceNamesExisting.ToList();
            _deviceNamesExisting.Remove(deviceModel.Name);
            _existingIps = (await _driversService.GetAllDriversAsync()).Select((driver => driver.CreateMomento().State.GetTcpAddress())).ToList();
            _existingIps.Remove(deviceModel.TcpAddress);
            if (deviceModel == null)
            {
                throw new NullReferenceException("Editing deviceViewModel don't be a null");
            }
            DeviceType          = deviceModel.DeviceFactoryTypeName;
            this.DeviceName     = deviceModel.Name;
            this.Description    = deviceModel.Description;
            this.TcpIpAddress   = deviceModel.TcpAddress;
            this.TcpIpPort      = deviceModel.TcpPort.ToString();
            this.TransformKoefA = deviceModel.TransformKoefA.ToString();
            this.TransformKoefB = deviceModel.TransformKoefB.ToString();
            this.TransformKoefC = deviceModel.TransformKoefC.ToString();


            if (!string.IsNullOrEmpty(deviceModel.AnalogMeterTypeName))
            {
                if (deviceModel.AnalogMeterTypeName.Equals(DeviceStringKeys.DeviceAnalogMetersTagKeys.NO))
                {
                    SelectedAnalogMeter = AnalogMetersEnum.Нет.ToString();
                }
                if (deviceModel.AnalogMeterTypeName.Equals(DeviceStringKeys.DeviceAnalogMetersTagKeys.ENERGOMERA_METER_TYPE))
                {
                    SelectedAnalogMeter = AnalogMetersEnum.Энергомера.ToString();
                }
                if (deviceModel.AnalogMeterTypeName.Equals(DeviceStringKeys.DeviceAnalogMetersTagKeys.MSA_METER_TYPE))
                {
                    SelectedAnalogMeter = AnalogMetersEnum.МСА961.ToString();
                }
            }


            if (deviceModel.CustomFidersOnDevice.Count != 0)
            {
                IsFiderOrganization = true;
                deviceModel.CustomFidersOnDevice.ForEach((fider =>
                {
                    FiderDefinitionsViewModels.Add(_fiderViewModelFactory.CreateFiderDefinitionsViewModel(fider));
                }));
            }

            if (deviceModel.CustomIndicatorsOnDevice?.Count != 0)
            {
                IsIndicatorsEnabled = true;
                deviceModel.CustomIndicatorsOnDevice.ForEach((ind =>
                {
                    IndicatorDefinitionsViewModels.Add(_indicatorViewModelFactory.CreateIndicatorDefinitionsViewModel(ind));
                }));
            }
            if (deviceModel.CustomSignalsOnDevice?.Count != 0)
            {
                IsSignalsEnabled = true;
                deviceModel.CustomSignalsOnDevice.ForEach((signal =>
                {
                    SignalDefinitionsViewModels.Add(_signalViewModelFactory.CreateSignalDefinitionsViewModel(signal));
                }));
            }

            if (deviceModel.CascadeIndicatorsOnDevice.Count != 0)
            {
                IsCascadeEnabled = true;
                deviceModel.CascadeIndicatorsOnDevice.ForEach((cascade =>
                {
                    CascadeDefinitionsViewModels.Add(_cascadeViewModelFactory.CreateCascadeDefinitionsViewModel(cascade));
                }));
            }



            StarterDescriptionsViewModels.Clear();
            int index = 1;

            for (int i = 1; i <= 3; i++)
            {
                if (deviceModel.StarterDescriptions.Count > i - 1)
                {
                    StarterDescriptionsViewModels.Add(new StarterDescriptionViewModel()
                    {
                        Description  = deviceModel.StarterDescriptions[i - 1],
                        IndexAndType = "Описание пускателя" + index
                    });
                    index++;
                }
                else
                {
                    StarterDescriptionsViewModels.Add(new StarterDescriptionViewModel()
                    {
                        Description  = String.Empty,
                        IndexAndType = "Описание пускателя" + index
                    });
                    index++;
                }
            }



            StarterDescriptionsViewModels[0].SetChannelNumberOfStarter(uint.Parse(deviceModel.ChannelNumberOfStarter1));
            StarterDescriptionsViewModels[1].SetChannelNumberOfStarter(uint.Parse(deviceModel.ChannelNumberOfStarter2));
            StarterDescriptionsViewModels[2].SetChannelNumberOfStarter(uint.Parse(deviceModel.ChannelNumberOfStarter3));



            _isEditing    = true;
            OkButtonTitle = "Сохранить";
            ViewTitle     = "Редактирование виртуального устройства";
        }
 private void OnAddFiderExecute()
 {
     FiderDefinitionsViewModels.Add(_fiderViewModelFactory.CreateFiderDefinitionsViewModel(_customFiderCreator.Invoke()));
 }