本文整理汇总了C#中FiresecAPI.Models.DeviceConfiguration类的典型用法代码示例。如果您正苦于以下问题:C# DeviceConfiguration类的具体用法?C# DeviceConfiguration怎么用?C# DeviceConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeviceConfiguration类属于FiresecAPI.Models命名空间,在下文中一共展示了DeviceConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ConvertDevicesAndZones
public DeviceConfiguration ConvertDevicesAndZones(Models.CoreConfiguration.config coreConfig)
{
var deviceConfiguration = new DeviceConfiguration();
ConvertZones(deviceConfiguration, coreConfig);
ConvertDevices(deviceConfiguration, coreConfig);
return deviceConfiguration;
}
示例3: ReadItem
public static FS2JournalItem ReadItem(DeviceConfiguration deviceConfiguration, Device device, int i, byte journalType)
{
for (int j = 0; j < 15; j++)
{
var response = USBManager.Send(device, "Чтение конкретной записи в журнале", 0x01, 0x20, journalType, BitConverter.GetBytes(i).Reverse());
if (response != null)
{
lock (Locker)
{
var journalParser = new JournalParser();
try
{
var fsJournalItem = journalParser.Parce(deviceConfiguration, device, response.Bytes, journalType);
if (fsJournalItem != null)
{
return fsJournalItem;
}
}
catch
{
return null;
}
}
}
}
return null;
}
示例4: SetTempDeviceConfiguration
public static Device SetTempDeviceConfiguration(Device device)
{
CurrentDeviceConfiguration = ConfigurationManager.DeviceConfiguration;
ConfigurationManager.DeviceConfiguration = CreateTempDeviceConfiguration(device);
USBManager.Initialize();
return ConfigurationManager.DeviceConfiguration.RootDevice.Children.FirstOrDefault();
}
示例5: AutoSearchViewModel
public AutoSearchViewModel(DeviceConfiguration autodetectedDeviceConfiguration)
{
Title = "Добавление устройств";
ContinueCommand = new RelayCommand(OnContinue);
allDevices = new List<AutoSearchDeviceViewModel>();
Devices = new List<AutoSearchDeviceViewModel>();
Devices.Add(AddDevice(autodetectedDeviceConfiguration.RootDevice, null));
}
示例6: FullConfiguration
public FullConfiguration()
{
DeviceConfiguration = new DeviceConfiguration();
LibraryConfiguration = new LibraryConfiguration();
PlansConfiguration = new PlansConfiguration();
SecurityConfiguration = new SecurityConfiguration();
SystemConfiguration = new SystemConfiguration();
XDeviceConfiguration = new XDeviceConfiguration();
}
示例7: ConvertPlans
public OperationResult<PlansConfiguration> ConvertPlans(DeviceConfiguration deviceConfiguration)
{
var result = FiresecSerializedClient.GetPlans();
if (result.HasError)
{
return new OperationResult<PlansConfiguration>(result.Error);
}
var plans = result.Result;
if (plans == null)
return new OperationResult<PlansConfiguration>();
var plansConfiguration = ConvertPlans(plans, deviceConfiguration);
return new OperationResult<PlansConfiguration>() { Result = plansConfiguration };
}
示例8: CopyOneBranch
public DeviceConfiguration CopyOneBranch(Device device, bool isUsb)
{
var deviceConfiguration = new DeviceConfiguration();
Device currentDevice = device;
Device copyChildDevice = null;
while (true)
{
var copyDevice = new Device();
//{
// UID = currentDevice.UID,
// DriverUID = currentDevice.DriverUID,
// IntAddress = currentDevice.IntAddress,
// Description = currentDevice.Description,
// ZoneUID = currentDevice.ZoneUID,
// Properties = new List<Property>(currentDevice.Properties),
// SystemAUProperties = new List<Property>(currentDevice.SystemAUProperties),
// DeviceAUProperties = new List<Property>(currentDevice.DeviceAUProperties)
//};
copyDevice.UID = currentDevice.UID;
copyDevice.DriverUID = currentDevice.DriverUID;
copyDevice.IntAddress = currentDevice.IntAddress;
copyDevice.Description = currentDevice.Description;
copyDevice.ZoneUID = currentDevice.ZoneUID;
copyDevice.Properties = new List<Property>(currentDevice.Properties);
if (currentDevice.SystemAUProperties != null)
copyDevice.SystemAUProperties = new List<Property>(currentDevice.SystemAUProperties);
if (currentDevice.DeviceAUProperties != null)
copyDevice.DeviceAUProperties = new List<Property>(currentDevice.DeviceAUProperties);
if ((currentDevice.UID == device.UID))
{
copyDevice.IsAltInterface = isUsb;
}
if (copyChildDevice != null)
copyDevice.Children.Add(copyChildDevice);
if (currentDevice.Parent == null)
{
currentDevice = copyDevice;
break;
}
copyChildDevice = copyDevice;
currentDevice = currentDevice.Parent;
}
deviceConfiguration.RootDevice = currentDevice;
return deviceConfiguration;
}
示例9: DeviceTreeViewModel
public DeviceTreeViewModel(Device rootDevice, DeviceConfiguration deviceConfiguration)
{
Title = "Сравнение конфигураций";
RootDevice = rootDevice;
DeviceConfiguration = deviceConfiguration;
DeviceConfiguration.Reorder();
BuildTree(rootDevice);
if (Devices.Count > 0)
{
//CollapseChild(Devices[0]);
ExpandChild(Devices[0]);
SelectedDevice = Devices[0];
}
}
示例10: Convert
public void Convert()
{
FiresecConfiguration = FiresecSerializedClient.GetCoreConfig().Result;
DeviceConfiguration = new DeviceConfiguration();
ConvertZones();
ConvertDirections();
ConvertGuardUsers();
ConvertDevices();
Update();
ConfigurationCash.DeviceConfiguration = DeviceConfiguration;
ConfigurationFileManager.SetDeviceConfiguration(DeviceConfiguration);
var plans = FiresecSerializedClient.GetPlans().Result;
ConfigurationCash.PlansConfiguration = ConvertPlans(plans);
ConfigurationFileManager.SetPlansConfiguration(ConfigurationCash.PlansConfiguration);
}
示例11: ConvertDevices
void ConvertDevices(DeviceConfiguration deviceConfiguration, Firesec.Models.CoreConfiguration.config coreConfig)
{
deviceConfiguration.Devices = new List<Device>();
if (coreConfig == null || coreConfig.dev == null || coreConfig.dev.Count() == 0 || coreConfig.drv == null)
{
Logger.Error("ConfigurationConverter.ConvertDevices coreConfig.dev = null");
LoadingErrorManager.Add("Пустая коллекция устройств или драйверов при конвертации конфигурации");
return;
}
var rootInnerDevice = coreConfig.dev[0];
var rootDevice = SetInnerDevice(rootInnerDevice, null, deviceConfiguration, coreConfig);
deviceConfiguration.Devices.Add(rootDevice);
AddDevice(rootInnerDevice, rootDevice, deviceConfiguration, coreConfig);
deviceConfiguration.RootDevice = rootDevice;
}
示例12: CreateTempDeviceConfiguration
public static DeviceConfiguration CreateTempDeviceConfiguration(Device device)
{
var deviceConfiguration = new DeviceConfiguration();
deviceConfiguration.RootDevice = new Device();
deviceConfiguration.RootDevice.Driver = ConfigurationManager.Drivers.FirstOrDefault(x => x.DriverType == DriverType.Computer);
deviceConfiguration.RootDevice.DriverUID = deviceConfiguration.RootDevice.Driver.UID;
Device usbDevice = (Device)device.Clone();
var driverType = DriverTypeToUSBDriverType(device.Driver.DriverType);
usbDevice.Driver = ConfigurationManager.Drivers.FirstOrDefault(x => x.DriverType == driverType);
usbDevice.DriverUID = deviceConfiguration.RootDevice.Driver.UID;
deviceConfiguration.RootDevice.Children.Add(usbDevice);
usbDevice.Parent = deviceConfiguration.RootDevice;
return deviceConfiguration;
}
示例13: AddDevice
void AddDevice(devType parentInnerDevice, Device parentDevice, DeviceConfiguration deviceConfiguration, Firesec.Models.CoreConfiguration.config coreConfig)
{
if (parentInnerDevice.dev == null)
return;
parentDevice.Children = new List<Device>();
foreach (var innerDevice in parentInnerDevice.dev)
{
var device = SetInnerDevice(innerDevice, parentDevice, deviceConfiguration, coreConfig);
if (device != null)
{
parentDevice.Children.Add(device);
deviceConfiguration.Devices.Add(device);
AddDevice(innerDevice, device, deviceConfiguration, coreConfig);
}
}
}
示例14: 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);
}
示例15: Convert
public static IndicatorLogic Convert(DeviceConfiguration deviceConfiguration, LEDProperties lEDProperties)
{
var indicatorLogic = new IndicatorLogic();
switch (lEDProperties.type)
{
case "0":
indicatorLogic.IndicatorLogicType = IndicatorLogicType.Zone;
break;
case "1":
indicatorLogic.IndicatorLogicType = IndicatorLogicType.Device;
break;
}
if (lEDProperties.zone != null)
{
foreach (var item in lEDProperties.zone)
{
if (string.IsNullOrWhiteSpace(item) == false)
{
int zoneNo = int.Parse(item);
var zone = deviceConfiguration.Zones.FirstOrDefault(x => x.No == zoneNo);
if (zone != null)
{
indicatorLogic.ZoneUIDs.Add(zone.UID);
}
}
}
}
if (lEDProperties.device != null && lEDProperties.device.Count() > 0)
{
var indicatorDevice = lEDProperties.device[0];
indicatorLogic.DeviceUID = GuidHelper.ToGuid(indicatorDevice.UID);
indicatorLogic.OnColor = StringToIndicatorColorType(indicatorDevice.state1);
indicatorLogic.OffColor = StringToIndicatorColorType(indicatorDevice.state2);
indicatorLogic.FailureColor = StringToIndicatorColorType(indicatorDevice.state3);
indicatorLogic.ConnectionColor = StringToIndicatorColorType(indicatorDevice.state4);
}
return indicatorLogic;
}