当前位置: 首页>>代码示例>>C#>>正文


C# DeviceConfiguration.Update方法代码示例

本文整理汇总了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();
        }
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:26,代码来源:ConfigurationConverter.cs

示例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);
        }
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:17,代码来源:DeviceConfigurationViewModel.cs

示例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;
		}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:42,代码来源:DeviceStatesManager.cs

示例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");
			}
		}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:19,代码来源:FiresecConfiguration.cs

示例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();
		}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:25,代码来源:ConfigurationConverter.cs

示例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;
		}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:34,代码来源:ConfigurationConverter.cs

示例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();
        }
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:21,代码来源:ConfigurationConverter.cs

示例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);
        }
开发者ID:saeednazari,项目名称:Rubezh,代码行数:84,代码来源:DeviceConfigurationViewModel.cs


注:本文中的FiresecAPI.Models.DeviceConfiguration.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。