本文整理汇总了C#中FiresecAPI.Models.DeviceConfiguration.UpdateCrossReferences方法的典型用法代码示例。如果您正苦于以下问题:C# DeviceConfiguration.UpdateCrossReferences方法的具体用法?C# DeviceConfiguration.UpdateCrossReferences怎么用?C# DeviceConfiguration.UpdateCrossReferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FiresecAPI.Models.DeviceConfiguration
的用法示例。
在下文中一共展示了DeviceConfiguration.UpdateCrossReferences方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}