本文整理汇总了C#中FiresecAPI.Models.DeviceConfiguration.Update方法的典型用法代码示例。如果您正苦于以下问题:C# DeviceConfiguration.Update方法的具体用法?C# DeviceConfiguration.Update怎么用?C# DeviceConfiguration.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FiresecAPI.Models.DeviceConfiguration
的用法示例。
在下文中一共展示了DeviceConfiguration.Update方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertBack
public void ConvertBack(DeviceConfiguration deviceConfiguration, bool includeSecurity)
{
DeviceConfiguration = deviceConfiguration;
DeviceConfiguration.Update();
foreach (var device in DeviceConfiguration.Devices)
{
device.Driver = ConfigurationCash.DriversConfiguration.Drivers.FirstOrDefault(x => x.UID == device.DriverUID);
}
if (includeSecurity)
{
FiresecConfiguration = FiresecSerializedClient.GetCoreConfig().Result;
FiresecConfiguration.part = null;
}
else
{
FiresecConfiguration = new Firesec.CoreConfiguration.config();
}
Gid = 0;
ConvertZonesBack();
ConvertDevicesBack();
ConvertDirectionsBack();
ConvertGuardUsersBack();
}
示例2: DeviceConfigurationViewModel
public DeviceConfigurationViewModel(Guid deviceUID, DeviceConfiguration deviceConfiguration)
{
Title = "Сравнение конфигураций";
ReplaceCommand = new RelayCommand(OnReplace);
_deviceUID = deviceUID;
_deviceConfiguration = deviceConfiguration;
_deviceConfiguration.Update();
foreach (var device in _deviceConfiguration.Devices)
{
device.Driver = FiresecManager.FiresecConfiguration.Drivers.FirstOrDefault(x => x.UID == device.DriverUID);
}
LocalRootDevice = FiresecManager.Devices.FirstOrDefault(x => x.UID == _deviceUID);
RemoteRootDevice = _deviceConfiguration.Devices.FirstOrDefault(x => x.UID == _deviceUID);
LocalDevices = new DeviceTreeViewModel(LocalRootDevice, FiresecManager.FiresecConfiguration.DeviceConfiguration);
RemoteDevices = new DeviceTreeViewModel(RemoteRootDevice, _deviceConfiguration);
}
示例3: ReadConfigurationAndUpdateStates
public bool ReadConfigurationAndUpdateStates(Device panelDevice)
{
var getConfigurationOperationHelper = new GetConfigurationOperationHelper(true);
RemoteDeviceConfiguration = getConfigurationOperationHelper.GetDeviceConfiguration(panelDevice);
if (RemoteDeviceConfiguration == null)
return false;
RemoteDeviceConfiguration.Update();
var isDBMissmatch = !ConfigurationCompareHelper.Compare(panelDevice, RemoteDeviceConfiguration);
if (panelDevice.DeviceState.IsDBMissmatch != isDBMissmatch)
{
panelDevice.DeviceState.IsDBMissmatch = isDBMissmatch;
ForseUpdateDeviceStates(panelDevice);
}
var remoteRealChildren = RemoteDeviceConfiguration.RootDevice.GetRealChildren();
var localRealChildren = panelDevice.GetRealChildren();
foreach (var remoteDevice in remoteRealChildren)
{
var device = localRealChildren.FirstOrDefault(x => x.IntAddress == remoteDevice.IntAddress);
if (device != null)
{
device.StateWordOffset = remoteDevice.StateWordOffset;
device.StateWordBytes = remoteDevice.StateWordBytes;
device.RawParametersOffset = remoteDevice.RawParametersOffset;
device.RawParametersBytes = remoteDevice.RawParametersBytes;
ParseDeviceState(device);
}
}
foreach (var remoteZone in RemoteDeviceConfiguration.Zones)
{
var zone = ConfigurationManager.Zones.FirstOrDefault(x => x.No == remoteZone.No);
if (zone != null)
{
zone.LocalDeviceNo = remoteZone.LocalDeviceNo;
}
}
return true;
}
示例4: SetEmptyConfiguration
public void SetEmptyConfiguration()
{
DeviceConfiguration = new DeviceConfiguration();
var computerDriver = DriversConfiguration.Drivers.FirstOrDefault(x => x.DriverType == DriverType.Computer);
if (computerDriver != null)
{
DeviceConfiguration.RootDevice = new Device()
{
DriverUID = computerDriver.UID,
Driver = computerDriver
};
DeviceConfiguration.Update();
}
else
{
Logger.Error("FiresecConfiguration.SetEmptyConfiguration computerDriver = null");
}
}
示例5: Update
void Update(DeviceConfiguration deviceConfiguration = null)
{
if (deviceConfiguration == null)
{
Logger.Error("ConfigurationConverter.Update deviceConfiguration = null");
throw new FiresecException("Нулевая кофигурация устройств при обновлении");
}
var hasInvalidDriver = false;
deviceConfiguration.Update();
foreach (var device in deviceConfiguration.Devices)
{
device.Driver = ConfigurationCash.DriversConfiguration.Drivers.FirstOrDefault(x => x.UID == device.DriverUID);
if (device.Driver == null)
{
hasInvalidDriver = true;
if (device.Parent != null)
device.Parent.Children.Remove(device);
}
}
if (hasInvalidDriver)
deviceConfiguration.Update();
deviceConfiguration.UpdateIdPath();
}
示例6: ConvertBack
public Firesec.Models.CoreConfiguration.config ConvertBack(DeviceConfiguration deviceConfiguration, bool includeSecurity)
{
deviceConfiguration.Update();
foreach (var device in deviceConfiguration.Devices)
{
device.Driver = ConfigurationCash.DriversConfiguration.Drivers.FirstOrDefault(x => x.UID == device.DriverUID);
}
var coreConfig = new Firesec.Models.CoreConfiguration.config();
if (includeSecurity)
{
var result = EmptyConfigHelper.GetCoreConfig();
if (result.HasError)
{
return null;
}
coreConfig = result.Result;
if (coreConfig == null)
{
Logger.Error("ConfigurationConverter.FiresecConfiguration == null");
return null;
}
coreConfig.part = null;
}
int gid = 0;
ConvertZonesBack(deviceConfiguration, coreConfig);
ConvertDevicesBack(deviceConfiguration, coreConfig);
ConvertDirectionsBack(deviceConfiguration, coreConfig, ref gid);
ConvertGuardUsersBack(deviceConfiguration, coreConfig, ref gid);
return coreConfig;
}
示例7: Update
public void Update(DeviceConfiguration deviceConfiguration = null)
{
if (deviceConfiguration == null)
deviceConfiguration = ConfigurationCash.DeviceConfiguration;
var hasInvalidDriver = false;
deviceConfiguration.Update();
foreach (var device in deviceConfiguration.Devices)
{
device.Driver = ConfigurationCash.DriversConfiguration.Drivers.FirstOrDefault(x => x.UID == device.DriverUID);
if (device.Driver == null)
{
hasInvalidDriver = true;
device.Parent.Children.Remove(device);
}
}
if (hasInvalidDriver)
deviceConfiguration.Update();
deviceConfiguration.UpdateIdPath();
}
示例8: DeviceConfigurationViewModel
public DeviceConfigurationViewModel(Guid deviceUID, DeviceConfiguration remoteDeviceConfiguration)
{
Title = "Сравнение конфигураций";
ReplaceCommand = new RelayCommand(OnReplace);
if (remoteDeviceConfiguration == null)
{
MessageBoxService.ShowError("Ошибка при считывании конфигурации");
return;
}
RemoteDeviceConfiguration = remoteDeviceConfiguration;
RemoteDeviceConfiguration.Reorder();
RemoteDeviceConfiguration.Update();
RemoteDeviceConfiguration.InvalidateConfiguration();
RemoteDeviceConfiguration.UpdateCrossReferences();
//foreach (var device in RemoteDeviceConfiguration.Devices)
//{
// device.Driver = FiresecManager.Drivers.FirstOrDefault(x => x.UID == device.Driver.UID);
//}
LocalRootDevice = FiresecManager.Devices.FirstOrDefault(x => x.UID == deviceUID);
RemoteRootDevice = RemoteDeviceConfiguration.Devices.FirstOrDefault(x => x.UID == deviceUID);
RemoteRootDevice.Driver = LocalRootDevice.Driver;
LocalRootClone = (Device)FiresecManager.Devices.FirstOrDefault(x => x.UID == deviceUID).Clone();
RemoteRootClone = (Device)RemoteDeviceConfiguration.Devices.FirstOrDefault(x => x.UID == deviceUID).Clone();
LocalRootClone.Children = new List<Device>();
if (LocalRootDevice.Children != null)
foreach (var children in LocalRootDevice.Children)
{
var childrenClone = (Device)children.Clone();
childrenClone.DeviceConfiguration = FiresecManager.FiresecConfiguration.DeviceConfiguration;
LocalRootClone.Children.Add(childrenClone);
if (children.Children != null)
{
var localchch =
LocalRootClone.Children.FirstOrDefault(
x =>
((x.PresentationName == children.PresentationName) &&
(x.AddressFullPath == children.AddressFullPath)));
localchch.Children = new List<Device>();
foreach (var chch in children.Children)
{
var chchClone = (Device)chch.Clone();
chchClone.DeviceConfiguration = FiresecManager.FiresecConfiguration.DeviceConfiguration;
localchch.Children.Add(chchClone);
}
}
}
RemoteRootClone.Children = new List<Device>();
if (RemoteRootDevice.Children != null)
foreach (var children in RemoteRootDevice.Children)
{
var childrenClone = (Device)children.Clone();
childrenClone.DeviceConfiguration = RemoteDeviceConfiguration;
RemoteRootClone.Children.Add(childrenClone);
if (children.Children != null)
{
var remotechch =
RemoteRootClone.Children.FirstOrDefault(
x =>
((x.PresentationName == children.PresentationName) &&
(x.AddressFullPath == children.AddressFullPath)));
remotechch.Children = new List<Device>();
foreach (var chch in children.Children)
{
var chchClone = (Device)chch.Clone();
chchClone.DeviceConfiguration = RemoteDeviceConfiguration;
remotechch.Children.Add(chchClone);
}
}
}
IntoLocalDevice(LocalRootDevice, RemoteRootClone);
IntoRemoteDevice(RemoteRootDevice, LocalRootClone);
Sort(LocalRootClone);
Sort(RemoteRootClone);
LocalDevices = new DeviceTreeViewModel(LocalRootClone);
RemoteDevices = new DeviceTreeViewModel(RemoteRootClone);
}