本文整理汇总了C#中FiresecAPI.Models.Device类的典型用法代码示例。如果您正苦于以下问题:C# Device类的具体用法?C# Device怎么用?C# Device使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Device类属于FiresecAPI.Models命名空间,在下文中一共展示了Device类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddDevice
public void AddDevice(Device fsDevice, XDevice kauDevice, byte shleifNo)
{
var driver = XManager.Drivers.FirstOrDefault(x => x.UID == fsDevice.DriverUID);
if (driver == null)
{
return;
}
var device = new XDevice()
{
UID = fsDevice.UID,
DriverUID = driver.UID,
Driver = driver,
IntAddress = (byte)(fsDevice.IntAddress & 0xff),
Description = fsDevice.Description
};
XManager.DeviceConfiguration.Devices.Add(device);
var shleifDevice = kauDevice.Children.FirstOrDefault(x => x.ShleifNo == shleifNo);
if (shleifDevice != null)
{
shleifDevice.Children.Add(device);
device.Parent = shleifDevice;
}
foreach (var fsChildDevice in fsDevice.Children)
{
AddDevice(fsChildDevice, device, shleifNo);
}
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:29,代码来源:FiresecToGKConverter.cs
示例2: Run
public static void Run(Device device, bool isUsb)
{
_device = device;
_isUsb = isUsb;
ServiceFactory.ProgressService.Run(OnPropgress, OnCompleted, _device.PresentationAddressAndName + ". Чтение журнала");
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:7,代码来源:ReadDeviceJournallHelper.cs
示例3: SynchronizeChildern
public void SynchronizeChildern(Device device)
{
for (int i = device.Children.Count(); i > 0; i--)
{
var childDevice = device.Children[i - 1];
if (device.Driver.AvaliableChildren.Contains(childDevice.Driver.UID) == false)
{
device.Children.RemoveAt(i - 1);
}
}
foreach (var autoCreateChildUID in device.Driver.AutoCreateChildren)
{
var autoCreateDriver = DriversConfiguration.Drivers.FirstOrDefault(x => x.UID == autoCreateChildUID);
for (int i = autoCreateDriver.MinAutoCreateAddress; i <= autoCreateDriver.MaxAutoCreateAddress; i++)
{
var newDevice = new Device()
{
DriverUID = autoCreateDriver.UID,
Driver = autoCreateDriver,
IntAddress = i
};
if (device.Children.Any(x => x.Driver.DriverType == newDevice.Driver.DriverType && x.IntAddress == newDevice.IntAddress) == false)
{
device.Children.Add(newDevice);
newDevice.Parent = device;
}
}
}
device.SynchronizeChildern();
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:34,代码来源:FiresecConfiguration.Device.cs
示例4: DeviceDetailsViewModel
public DeviceDetailsViewModel(Device device)
{
ExecuteCommand = new RelayCommand(OnExecute);
DeviceCommands = new List<DeviceCommandViewModel>();
Device = device;
DeviceState = Device.DeviceState;
DeviceState.StateChanged += new Action(OnStateChanged);
DeviceState.ParametersChanged += new Action(OnParametersChanged);
OnStateChanged();
Title = Device.DottedPresentationAddressAndName;
TopMost = true;
var tableNo = MetadataHelper.GetDeviceTableNo(device);
var metadataDeviceCommands = MetadataHelper.Metadata.devicePropInfos.Where(x => x.tableType == tableNo);
foreach (var metadataDeviceCommand in metadataDeviceCommands)
{
var deviceCommandViewModel = new DeviceCommandViewModel()
{
Name = metadataDeviceCommand.name,
Caption = metadataDeviceCommand.caption,
};
DeviceCommands.Add(deviceCommandViewModel);
}
SelectedDeviceCommand = DeviceCommands.FirstOrDefault();
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:26,代码来源:DeviceDetailsViewModel.cs
示例5: Run
public static void Run(Device device, bool isUsb)
{
_device = device;
_isUsb = isUsb;
ServiceFactory.ProgressService.Run(OnPropgress, OnCompleted, device.PresentationAddressAndName + ". Установка времени");
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:7,代码来源:SynchronizeDeviceHelper.cs
示例6: GetLocalForZone
public static List<DevicesOnShleif> GetLocalForZone(Device parentPanel, Zone zone)
{
var devicesOnShleifs = new List<DevicesOnShleif>();
for (int i = 1; i <= parentPanel.Driver.ShleifCount; i++)
{
var devicesOnShleif = new DevicesOnShleif()
{
ShleifNo = i
};
devicesOnShleifs.Add(devicesOnShleif);
}
var effectorDevices = GetDevicesInLogic(zone);
foreach (var device in effectorDevices.OrderBy(x => x.IntAddress))
{
if (device.ParentPanel.UID == parentPanel.UID)
{
var shleifNo = device.ShleifNo;
if (device.Driver.DriverType == DriverType.PumpStation)
shleifNo = 1;
var devicesOnShleif = devicesOnShleifs.FirstOrDefault(x => x.ShleifNo == shleifNo);
if (devicesOnShleif != null)
{
devicesOnShleif.Devices.Add(device);
}
}
}
return devicesOnShleifs;
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:29,代码来源:DevicesOnShleifHelper.cs
示例7: MPTTimerViewModel
public MPTTimerViewModel(Device device)
{
Title = "Включение МПТ. Обратный отсчет" + device.DottedAddress;
TopMost = true;
Device = device;
_guid = device.UID;
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:7,代码来源:MPTTimerViewModel.cs
示例8: IndicatorDeviceSelectionViewModel
public IndicatorDeviceSelectionViewModel(Device indicatorDevice, Device device)
{
Title = "Выбор устройства";
IndicatorDevice = indicatorDevice;
InitializeDevices();
SelectedDevice = device;
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:7,代码来源:IndicatorDeviceSelectionViewModel.cs
示例9: ClauseViewModel
public ClauseViewModel(ZoneLogicViewModel zoneLogicViewModel, Device device, Clause clause)
{
ShowZonesCommand = new RelayCommand(OnShowZones);
SelectDeviceCommand = new RelayCommand(OnSelectDevice);
_zoneLogicViewModel = zoneLogicViewModel;
Device = device;
Zones = new List<Guid>(
from zoneUID in clause.ZoneUIDs
select zoneUID);
Zones = clause.ZoneUIDs.ToList();
_selectedState = clause.State;
SelectedOperation = clause.Operation;
if (clause.DeviceUIDs == null)
{
clause.DeviceUIDs = new List<Guid>();
}
SelectedDevices = new List<Device>();
foreach (var deviceUID in clause.DeviceUIDs)
{
var deviceInClause = FiresecManager.Devices.FirstOrDefault(x => x.UID == deviceUID);
if (deviceInClause != null)
{
SelectedDevices.Add(deviceInClause);
}
}
SelectedMROMessageNo = clause.ZoneLogicMROMessageNo;
SelectedMROMessageType = clause.ZoneLogicMROMessageType;
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:31,代码来源:ClauseViewModel.cs
示例10: SetDevice
public static void SetDevice(ElementDevice element, Device device)
{
ResetDevice(element);
element.DeviceUID = device == null ? Guid.Empty : device.UID;
if (device != null)
device.PlanElementUIDs.Add(element.UID);
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:7,代码来源:Helper.cs
示例11: PDUPTTable
public PDUPTTable(DevicePDUDirection devicePDUDirection, PanelDatabase panelDatabase)
: base(null, devicePDUDirection.PDUGroupDevice.Device.DottedPresentationNameAndAddress)
{
Device = devicePDUDirection.PDUGroupDevice.Device;
BytesDatabase = new BytesDatabase(Device.DottedPresentationNameAndAddress);
BytesDatabase.AddByte(Device.AddressOnShleif, "Адрес");
BytesDatabase.AddByte((Device.ShleifNo - 1), "Шлейф");
BytesDatabase.AddByte(Device.Parent.IntAddress, "Адрес прибора");
var deviceCode = FiresecAPI.Models.DriversHelper.GetCodeForDriver(Device.Driver.DriverType);
BytesDatabase.AddByte(deviceCode, "Тип ИУ");
var tableBase = panelDatabase.FlashDatabase.LocalZonesTableGroup.Tables.FirstOrDefault(x => x.UID == Device.Zone.UID);
var localZoneNo = (tableBase as ZoneTable).BinaryZone.LocalNo;
BytesDatabase.AddShort(localZoneNo, "Номер зоны");
BytesDatabase.AddByte(devicePDUDirection.Device.IntAddress, "Направление");
foreach (var tableGroup in panelDatabase.FlashDatabase.DevicesTableGroups)
{
tableBase = tableGroup.Tables.FirstOrDefault(x => x.UID == Device.UID);
if (tableBase != null)
{
break;
}
}
var offset = tableBase.BytesDatabase.ByteDescriptions.FirstOrDefault().Offset + 3;
var offsetBytes = BitConverter.GetBytes(offset);
for (int i = 0; i < 4; i++)
{
BytesDatabase.AddByte(offsetBytes[i], "Смещение");
}
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:32,代码来源:PDUPTTable.cs
示例12: UpdateRealChildrenStateOnPanelState
void UpdateRealChildrenStateOnPanelState(Device panelDevice, BitArray bitArray)
{
foreach (var device in panelDevice.GetRealChildren())
{
foreach (var metadataDeviceState in MetadataHelper.GetMetadataDeviceStates(device, true))
{
if (metadataDeviceState.leave != null)
{
foreach (var leaveDeviceState in metadataDeviceState.leave)
{
if (leaveDeviceState.panelState != null)
{
var pabelBitNo = Int32.Parse(leaveDeviceState.panelState);
var hasBit = bitArray[pabelBitNo];
if (!hasBit)
{
if (device.DeviceState.States.RemoveAll(x => x.DriverState.Code == metadataDeviceState.ID) > 0)
{
ForseUpdateDeviceStates(device);
}
}
}
}
}
}
}
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:27,代码来源:DeviceStatesManager.cs
示例13: Write
public static bool Write(Device device)
{
CallbackManager.AddProgress(new FS2ProgressInfo("Формирование базы данных устройств"));
var systemDatabaseCreator = new SystemDatabaseCreator();
systemDatabaseCreator.Create(0x3000);
Device parentPanel;
if ((device.Driver.DriverType == DriverType.IndicationBlock) || (device.Driver.DriverType == DriverType.PDU) || (device.Driver.DriverType == DriverType.PDU_PT))
{
var nonPanelDatabase = systemDatabaseCreator.NonPanelDatabases.FirstOrDefault(x => x.ParentPanel.UID == device.UID);
if (nonPanelDatabase == null)
throw new FS2Exception("Не найдена сформированная для устройства база данных");
parentPanel = nonPanelDatabase.ParentPanel;
var bytes = nonPanelDatabase.BytesDatabase.GetBytes();
CallbackManager.AddProgress(new FS2ProgressInfo("Запись базы данных в прибор"));
return SetConfigurationOperationHelper.WriteNonPanelDeviceConfiguration(parentPanel, bytes);
}
var panelDatabase = systemDatabaseCreator.PanelDatabases.FirstOrDefault(x => x.ParentPanel.UID == device.UID);
if (panelDatabase == null)
throw new FS2Exception("Не найдена сформированная для устройства база данных");
parentPanel = panelDatabase.ParentPanel;
var bytes1 = panelDatabase.RomDatabase.BytesDatabase.GetBytes();
var bytes2 = panelDatabase.FlashDatabase.BytesDatabase.GetBytes();
CallbackManager.AddProgress(new FS2ProgressInfo("Запись базы данных в прибор"));
return SetConfigurationOperationHelper.WriteDeviceConfiguration(parentPanel, bytes2, bytes1);
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:25,代码来源:ConfigurationWriterOperationHelper.cs
示例14: PropertiesViewModel
public PropertiesViewModel(Device device)
{
Device = device;
StringProperties = new List<StringPropertyViewModel>();
BoolProperties = new List<BoolPropertyViewModel>();
EnumProperties = new List<EnumPropertyViewModel>();
foreach (var driverProperty in device.Driver.Properties)
{
if (driverProperty.IsHidden)
continue;
switch (driverProperty.DriverPropertyType)
{
case DriverPropertyTypeEnum.EnumType:
EnumProperties.Add(new EnumPropertyViewModel(driverProperty, device));
break;
case DriverPropertyTypeEnum.StringType:
case DriverPropertyTypeEnum.IntType:
case DriverPropertyTypeEnum.ByteType:
StringProperties.Add(new StringPropertyViewModel(driverProperty, device));
break;
case DriverPropertyTypeEnum.BoolType:
BoolProperties.Add(new BoolPropertyViewModel(driverProperty, device));
break;
}
}
}
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:30,代码来源:PropertiesViewModel.cs
示例15: AddDevice
public Device AddDevice(Device parentDevice, Driver driver, int intAddress)
{
var device = new Device()
{
DriverUID = driver.UID,
Driver = driver,
IntAddress = intAddress,
Parent = parentDevice
};
if (parentDevice.Driver.DriverType == DriverType.MPT)
{
device.ZoneUID = parentDevice.ZoneUID;
}
if (driver.DriverType == DriverType.Valve)
{
device.Properties.Add(new Property() { Name = "Action", Value = "1" });
}
parentDevice.Children.Add(device);
AddAutoCreateChildren(device);
AddAutoChildren(device);
parentDevice.OnChanged();
DeviceConfiguration.Update();
return device;
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:25,代码来源:FiresecConfiguration.Actions.cs
示例16: IndicatorPageDetailsViewModel
public IndicatorPageDetailsViewModel(Device device)
{
Title = "Свойства страницы индикаторов. Автоматическая привязка к зонам";
ShowZonesCommand = new RelayCommand(OnShowZones);
Device = device;
InitializeZones();
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:7,代码来源:IndicatorPageDetailsViewModel.cs
示例17: GetRemoteForZone
public static List<Device> GetRemoteForZone(Device parentPanel, Zone zone)
{
var devices = new HashSet<Device>();
foreach (var device in GetDevicesInLogic(zone))
{
foreach (var clause in device.ZoneLogic.Clauses)
{
var allZonesAreRemote = true;
foreach (var clauseZone in clause.Zones)
{
if (clauseZone.DevicesInZone.FirstOrDefault().ParentPanel.UID == device.ParentPanel.UID)
allZonesAreRemote = false;
}
if (clause.Operation.Value == ZoneLogicOperation.Any || allZonesAreRemote)
{
foreach (var clauseZone in clause.Zones)
{
if (clauseZone.UID == zone.UID)
{
if (device.ParentPanel.UID != parentPanel.UID)
{
devices.Add(device);
}
}
}
}
}
}
return devices.ToList();
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:31,代码来源:DevicesOnShleifHelper.cs
示例18: DeviceSetGuardUsers
public static void DeviceSetGuardUsers(Device device, List<GuardUser> guardUsers)
{
for (int i = 0; i < guardUsers.Count; i++)
guardUsers[i].Id = i + 1;
SetConfigurationOperationHelper.ConfirmLongTermOperation(device);
// Данные таблицы
var guardUsersCount = (byte) guardUsers.Count; // 1 байт
var guardUsersBytes = GetGuardUsersByte(guardUsers);
var bytes = USBManager.CreateBytesArray(guardUsersCount, guardUsersBytes);
foreach (var guardUser in guardUsers)
{
bytes.AddRange(GuardUserDataToBytesList(device, guardUser));
}
// Добавление пустых пользователей
var emptyGuardUser = new GuardUser();
emptyGuardUser.KeyTM = new string('0', 12);
emptyGuardUser.Password = "";
for(int i = guardUsers.Count; i < 80; i++)
{
bytes.AddRange(GuardUserDataToBytesList(device, emptyGuardUser));
}
var begin = 0x14000;
for (int i = 0; i < bytes.Count; i = i + 0x100)
{
CallbackManager.AddProgress(new FS2ProgressInfo("Запись охранных пользователей", (i * 100) / bytes.Count));
USBManager.Send(device, "Запись охранных пользователей", 0x02, 0x52, BitConverter.GetBytes(begin + i).Reverse(), Math.Min(bytes.Count - i - 1, 0xFF), bytes.GetRange(i, Math.Min(bytes.Count - i, 0x100)));
}
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:32,代码来源:GuardUsersOperationHelper.cs
示例19: SetTempDeviceConfiguration
public static Device SetTempDeviceConfiguration(Device device)
{
CurrentDeviceConfiguration = ConfigurationManager.DeviceConfiguration;
ConfigurationManager.DeviceConfiguration = CreateTempDeviceConfiguration(device);
USBManager.Initialize();
return ConfigurationManager.DeviceConfiguration.RootDevice.Children.FirstOrDefault();
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:7,代码来源:USBConfigHelper.cs
示例20: ZoneSelectationViewModel
public ZoneSelectationViewModel(Device device)
{
Title = "Выбор зоны устройства " + device.PresentationAddressAndName;
CreateCommand = new RelayCommand(OnCreate);
EditCommand = new RelayCommand(OnEdit, CanEdit);
Device = device;
IsGuardDevice = (device.Driver.DeviceType == DeviceType.Sequrity);
Zones = new BindingList<ZoneViewModel>();
foreach (var zone in from zone in FiresecManager.Zones orderby zone.No select zone)
{
var isGuardZone = (zone.ZoneType == ZoneType.Guard);
if (isGuardZone ^ IsGuardDevice)
continue;
if (device.Driver.DriverType == DriverType.StopButton || device.Driver.DriverType == DriverType.StartButton || device.Driver.DriverType == DriverType.AutomaticButton)
{
if (!zone.DevicesInZone.Any(x => x.Driver.DriverType == DriverType.MPT))
continue;
}
var zoneViewModel = new ZoneViewModel(zone);
Zones.Add(zoneViewModel);
}
if (Device.Zone != null)
SelectedZone = Zones.FirstOrDefault(x => x.Zone == Device.Zone);
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:28,代码来源:ZoneSelectationViewModel.cs
注:本文中的FiresecAPI.Models.Device类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论