本文整理汇总了C#中XFiresecAPI.XDevice类的典型用法代码示例。如果您正苦于以下问题:C# XDevice类的具体用法?C# XDevice怎么用?C# XDevice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XDevice类属于XFiresecAPI命名空间,在下文中一共展示了XDevice类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetGKZones
public static IEnumerable<XZone> GetGKZones(XDevice device)
{
return from zone in DeviceConfiguration.Zones
where zone.GkDatabaseParent == device.GkDatabaseParent
orderby zone.No
select zone;
}
示例2: ValidateIPAddress
static void ValidateIPAddress(XDevice device)
{
if (!XManager.IsValidIpAddress(device))
{
Errors.Add(new DeviceValidationError(device, "Не верно задан IP адрес", ValidationErrorLevel.CannotWrite));
}
}
示例3: XDeviceState
public XDeviceState(XDevice device)
{
Device = device;
if (device.DriverType == XDriverType.System)
IsInitialState = false;
}
示例4: AddDevice
public void AddDevice(XDevice parentDevice, Device fsDevice)
{
var driver = XManager.DriversConfiguration.Drivers.FirstOrDefault(x => x.UID == fsDevice.DriverUID);
if (driver == null)
{
return;
}
var shleifNo = ((shleifPairNo - 1) * 2) + (fsDevice.IntAddress >> 8);
var xDevice = new XDevice()
{
UID = fsDevice.UID,
DriverUID = driver.UID,
Driver = driver,
ShleifNo = (byte)shleifNo,
IntAddress = (byte)(fsDevice.IntAddress & 0xff),
Description = fsDevice.Description
};
XManager.DeviceConfiguration.Devices.Add(xDevice);
parentDevice.Children.Add(xDevice);
xDevice.Parent = parentDevice;
foreach (var fsChildDevice in fsDevice.Children)
{
AddDevice(xDevice, fsChildDevice);
}
}
示例5: DeviceBinaryObject
public DeviceBinaryObject(XDevice device, DatabaseType databaseType)
{
DatabaseType = databaseType;
ObjectType = ObjectType.Device;
Device = device;
Build();
}
示例6: SynchronizeChildern
public static void SynchronizeChildern(XDevice xDevice)
{
for (int i = xDevice.Children.Count(); i > 0; i--)
{
var childDevice = xDevice.Children[i - 1];
if (xDevice.Driver.Children.Contains(childDevice.Driver.DriverType) == false)
{
xDevice.Children.RemoveAt(i - 1);
}
}
foreach (var autoCreateDriverType in xDevice.Driver.AutoCreateChildren)
{
var autoCreateDriver = XManager.DriversConfiguration.Drivers.FirstOrDefault(x => x.DriverType == autoCreateDriverType);
for (byte i = autoCreateDriver.MinAddress; i <= autoCreateDriver.MaxAddress; i++)
{
var newDevice = new XDevice()
{
DriverUID = autoCreateDriver.UID,
Driver = autoCreateDriver,
IntAddress = i
};
if (xDevice.Children.Any(x => x.Driver.DriverType == newDevice.Driver.DriverType && x.Address == newDevice.Address) == false)
{
xDevice.Children.Add(newDevice);
newDevice.Parent = xDevice;
}
}
}
}
示例7: CopyDevice
public static XDevice CopyDevice(XDevice device, bool fullCopy)
{
var newDevice = new XDevice()
{
DriverUID = device.DriverUID,
Driver = device.Driver,
IntAddress = device.IntAddress,
Description = device.Description
};
if (fullCopy)
{
newDevice.UID = device.UID;
}
newDevice.Properties = new List<XProperty>();
foreach (var property in device.Properties)
{
newDevice.Properties.Add(new XProperty()
{
Name = property.Name,
Value = property.Value
});
}
newDevice.Children = new List<XDevice>();
foreach (var childDevice in device.Children)
{
var newChildDevice = CopyDevice(childDevice, fullCopy);
newChildDevice.Parent = newDevice;
newDevice.Children.Add(newChildDevice);
}
return newDevice;
}
示例8: BaseAUPropertyViewModel
public BaseAUPropertyViewModel(XDriverProperty driverProperty, XDevice device)
{
DriverProperty = driverProperty;
Device = device;
if (!Device.Properties.Any(x => x.Name == driverProperty.Name))
{
Save(driverProperty.Default, false);
}
if (Device.DeviceProperties == null)
{
Device.DeviceProperties = new List<XProperty>();
}
var deviceProperty = Device.DeviceProperties.FirstOrDefault(x => x.Name == driverProperty.Name);
if (deviceProperty != null)
{
DeviceAUParameterValue = deviceProperty.Value.ToString();
//if ((deviceProperty.DriverProperty != null) && (deviceProperty.DriverProperty.DriverPropertyType == XDriverPropertyTypeEnum.EnumType))
//DeviceAUParameterValue = deviceProperty.DriverProperty.Parameters.FirstOrDefault(x => x.Value == deviceProperty.Value).Name;
}
else
DeviceAUParameterValue = "Неизвестно";
UpdateDeviceParameterMissmatchType();
}
示例9: DeviceExecutableCommandViewModel
public DeviceExecutableCommandViewModel(XDevice device, XStateBit stateType)
{
ExecuteControlCommand = new RelayCommand(OnExecuteControl);
Device = device;
StateBit = stateType;
Name = ((XStateBit)stateType).ToDescription();
if (Device.DriverType == XDriverType.Valve)
{
switch (stateType)
{
case XStateBit.TurnOn_InManual:
Name = "Открыть";
break;
case XStateBit.TurnOnNow_InManual:
Name = "Открыть немедленно";
break;
case XStateBit.TurnOff_InManual:
Name = "Закрыть";
break;
case XStateBit.Stop_InManual:
Name = "Остановить";
break;
}
}
}
示例10: GetDescriptorAddresses
bool GetDescriptorAddresses(XDevice device)
{
descriptorAddresses = new List<int>();
var startaddress = 0x078000;
while (true)
{
byte[] startAddressBytes = BitConverter.GetBytes(startaddress);
startaddress += 256;
var data = new List<byte>(startAddressBytes);
var sendResult = SendManager.Send(device, 4, 31, 256, data);
if (sendResult.Bytes.Count != 256)
{
Error = "Не удалось распознать дескриптор";
return false;
}
for (int i = 0; i < 256 / 4; i++)
{
var descriptorAddress = BytesHelper.SubstructInt(sendResult.Bytes, i * 4);
if (descriptorAddress == -1)
{
return true;
}
descriptorAddresses.Add(descriptorAddress);
}
}
}
示例11: RemoveDevice
public static void RemoveDevice(XDevice device)
{
var parentDevice = device.Parent;
foreach (var zone in device.Zones)
{
zone.Devices.Remove(device);
zone.OnChanged();
}
foreach (var direction in device.Directions)
{
direction.InputDevices.Remove(device);
direction.OutputDevices.Remove(device);
var directionDevice = direction.DirectionDevices.FirstOrDefault(x => x.Device == device);
if (directionDevice != null)
{
direction.DirectionDevices.Remove(directionDevice);
direction.InputDevices.Remove(device);
}
direction.OnChanged();
}
parentDevice.Children.Remove(device);
Devices.Remove(device);
if (parentDevice.DriverType == XDriverType.RSR2_KAU_Shleif)
RebuildRSR2Addresses(parentDevice.Parent);
device.OnChanged();
}
示例12: DeviceDescriptor
public DeviceDescriptor(XDevice device, DatabaseType databaseType)
{
DatabaseType = databaseType;
DescriptorType = DescriptorType.Device;
Device = device;
Build();
}
示例13: GetTankColor
public static Color GetTankColor(XDevice xdevice)
{
Color color = Colors.Black;
if (xdevice != null)
color = Colors.LightCyan;
return color;
}
示例14: UpdatedDeviceViewModel
public UpdatedDeviceViewModel(XDevice device)
{
Device = device;
Name = device.ShortName;
Address = device.DottedPresentationAddress;
ImageSource = device.Driver.ImageSource;
}
示例15: PropertiesViewModel
public PropertiesViewModel(XDevice xDevice)
{
XDevice = xDevice;
StringProperties = new List<StringPropertyViewModel>();
ShortProperties = new List<ShortPropertyViewModel>();
BoolProperties = new List<BoolPropertyViewModel>();
EnumProperties = new List<EnumPropertyViewModel>();
if (xDevice != null)
foreach (var driverProperty in xDevice.Driver.Properties)
{
switch (driverProperty.DriverPropertyType)
{
case XDriverPropertyTypeEnum.EnumType:
EnumProperties.Add(new EnumPropertyViewModel(driverProperty, xDevice));
break;
case XDriverPropertyTypeEnum.StringType:
StringProperties.Add(new StringPropertyViewModel(driverProperty, xDevice));
break;
case XDriverPropertyTypeEnum.IntType:
ShortProperties.Add(new ShortPropertyViewModel(driverProperty, xDevice));
break;
case XDriverPropertyTypeEnum.BoolType:
BoolProperties.Add(new BoolPropertyViewModel(driverProperty, xDevice));
break;
}
}
}