本文整理汇总了C#中RubezhAPI.GK.GKDevice类的典型用法代码示例。如果您正苦于以下问题:C# GKDevice类的具体用法?C# GKDevice怎么用?C# GKDevice使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GKDevice类属于RubezhAPI.GK命名空间,在下文中一共展示了GKDevice类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AnyZonesSelectionViewModel
public AnyZonesSelectionViewModel(GKDevice device)
{
Title = "Выбор зон";
Device = device;
ZonesSelectationViewModel = new ZonesSelectationViewModel(device.Zones, true);
GuardZonesWithFuncSelectationViewModel = new GuardZonesWithFuncSelectationViewModel(device, true);
}
示例2: BasePropertyViewModel
public BasePropertyViewModel(GKDriverProperty driverProperty, GKDevice device)
{
DriverProperty = driverProperty;
IsAUParameter = driverProperty.IsAUParameter;
Device = device;
if (!Device.Properties.Any(x => x.Name == driverProperty.Name))
{
Save(driverProperty.Default, false);
}
if (Device.DeviceProperties == null)
{
Device.DeviceProperties = new List<GKProperty>();
}
var deviceProperty = Device.DeviceProperties.FirstOrDefault(x => x.Name == driverProperty.Name);
if (deviceProperty != null)
{
double value = deviceProperty.Value;
if (DriverProperty.Multiplier != 0)
value /= DriverProperty.Multiplier;
DeviceAUParameterValue = value.ToString();
}
else
DeviceAUParameterValue = "Неизвестно";
UpdateDeviceParameterMissmatchType();
}
示例3: AddDevice
public static DeviceViewModel AddDevice(GKDevice device, DeviceViewModel parentDeviceViewModel, bool isAddDevice = true, bool isStartList = false)
{
var deviceViewModel = new DeviceViewModel(device);
if (isAddDevice)
{
if (isStartList)
parentDeviceViewModel.AddChildFirst(deviceViewModel);
else
parentDeviceViewModel.AddChild(deviceViewModel);
foreach (var childDevice in device.Children)
{
AddDevice(childDevice, deviceViewModel);
}
}
else
{
parentDeviceViewModel.InsertChild(deviceViewModel);
foreach (var childDevice in device.Children)
{
AddDevice(childDevice, deviceViewModel, !isAddDevice);
}
}
return deviceViewModel;
}
示例4: GKState
public GKState(GKDevice device)
: this()
{
Device = device;
UID = device.UID;
BaseObjectType = GKBaseObjectType.Device;
}
示例5: BaseAUPropertyViewModel
public BaseAUPropertyViewModel(GKDriverProperty driverProperty, GKDevice 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<GKProperty>();
}
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();
}
示例6: CheckDeviceLogicOnGK
void CheckDeviceLogicOnGK(GKDevice device)
{
var deviceGKDescriptor = GkDatabase.Descriptors.FirstOrDefault(x => x.GKBase == device);
var deviceKau1Descriptor = Kau1Database.Descriptors.FirstOrDefault(x => x.GKBase == device);
Assert.IsTrue(deviceGKDescriptor.Formula.FormulaOperations.Count > 1, "На ГК должна присутствовать логика устройства");
Assert.IsTrue(deviceKau1Descriptor.Formula.FormulaOperations.Count == 1, "На КАУ должна отсутствовать логика устройства");
}
示例7: AddCodeReaderLogic
public static void AddCodeReaderLogic(FormulaBuilder formula, GKCodeReaderSettingsPart settingsPart, GKDevice device)
{
var stateBit = CodeReaderEnterTypeToStateBit(settingsPart.CodeReaderEnterType);
formula.AddGetBit(stateBit, device);
formula.Add(FormulaOperationType.BR, 2, 2);
formula.Add(FormulaOperationType.CONST);
var gotoFormulaOperation = formula.Add(FormulaOperationType.BR, 0, 0);
var formulaNo = formula.FormulaOperations.Count;
var codeIndex = 0;
foreach (var codeUID in settingsPart.CodeUIDs)
{
var code = GKManager.DeviceConfiguration.Codes.FirstOrDefault(x => x.UID == codeUID);
formula.AddWithGKBase(FormulaOperationType.KOD, 0, device);
formula.AddWithGKBase(FormulaOperationType.CMPKOD, 1, code);
if (codeIndex > 0)
{
formula.Add(FormulaOperationType.OR);
}
codeIndex++;
}
if (settingsPart.AccessLevel > 0)
{
formula.AddWithGKBase(FormulaOperationType.ACS, (byte)settingsPart.AccessLevel, device);
if (codeIndex > 0)
{
formula.Add(FormulaOperationType.OR);
}
}
gotoFormulaOperation.SecondOperand = (ushort)(formula.FormulaOperations.Count - formulaNo);
}
示例8: GetTankColor
public static Color GetTankColor(GKDevice device)
{
Color color = Colors.Black;
if (device != null)
color = Colors.LightCyan;
return color;
}
示例9: DeviceSelectationViewModel
public DeviceSelectationViewModel(GKDevice selectedDevice, IEnumerable<GKDevice> sourceDevices = null)
{
Title = "Выбор устройства";
Devices = new ObservableCollection<GKDevice>(sourceDevices);
if (selectedDevice != null)
SelectedDevice = Devices.FirstOrDefault(x => x.UID == selectedDevice.UID);
}
示例10: DeviceGuardZoneViewModel
public DeviceGuardZoneViewModel(GKDeviceGuardZone deviceGuardZone, GKDevice device)
{
DeviceGuardZone = deviceGuardZone;
if (device != null)
IsCodeReader = device.Driver.IsCardReaderOrCodeReader;
No = deviceGuardZone.GuardZone.No;
Name = deviceGuardZone.GuardZone.Name;
Description = deviceGuardZone.GuardZone.Description;
ActionTypes = new ObservableCollection<GKGuardZoneDeviceActionType>();
if (device != null)
switch (device.DriverType)
{
case GKDriverType.RSR2_GuardDetector:
case GKDriverType.RSR2_GuardDetectorSound:
case GKDriverType.RSR2_HandGuardDetector:
ActionTypes.Add(GKGuardZoneDeviceActionType.SetAlarm);
break;
case GKDriverType.RSR2_AM_1:
case GKDriverType.RSR2_MAP4:
ActionTypes.Add(GKGuardZoneDeviceActionType.SetGuard);
ActionTypes.Add(GKGuardZoneDeviceActionType.ResetGuard);
ActionTypes.Add(GKGuardZoneDeviceActionType.ChangeGuard);
ActionTypes.Add(GKGuardZoneDeviceActionType.SetAlarm);
break;
}
if (deviceGuardZone.ActionType == null || !ActionTypes.Contains(deviceGuardZone.ActionType.Value))
SelectedActionType = ActionTypes.FirstOrDefault();
ShowPropertiesCommand = new RelayCommand(OnShowProperties);
}
示例11: DeviceExecutableCommandViewModel
public DeviceExecutableCommandViewModel(GKDevice device, GKStateBit stateType)
{
ExecuteControlCommand = new RelayCommand(OnExecuteControl);
Device = device;
StateBit = stateType;
Name = ((GKStateBit)stateType).ToDescription();
if (Device.DriverType == GKDriverType.RSR2_Valve_DU || Device.DriverType == GKDriverType.RSR2_Valve_KV || Device.DriverType == GKDriverType.RSR2_Valve_KVMV)
{
switch (stateType)
{
case GKStateBit.TurnOn_InManual:
Name = "Открыть";
break;
case GKStateBit.TurnOnNow_InManual:
Name = "Открыть немедленно";
break;
case GKStateBit.TurnOff_InManual:
Name = "Закрыть";
break;
case GKStateBit.Stop_InManual:
Name = "Остановить";
break;
}
}
}
示例12: GetDescriptorInfo
bool GetDescriptorInfo(GKDevice kauDevice, int descriptorAdderss)
{
var descriptorAdderssesBytes = new List<byte>(BitConverter.GetBytes(descriptorAdderss));
var data = new List<byte>(descriptorAdderssesBytes);
var sendResult = SendManager.Send(kauDevice, 4, 31, 256, data);
var bytes = sendResult.Bytes;
if (bytes.Count != 256)
{
Error = "Длина дескриптора не соответствует нужному значению";
return false;
}
var deviceType = BytesHelper.SubstructShort(bytes, 0);
var address = BytesHelper.SubstructShort(bytes, 2);
int shleifNo = (byte)(address / 256 + 1);
var device = new GKDevice();
device.Driver = GKManager.Drivers.FirstOrDefault(x => x.DriverTypeNo == deviceType);
if ((1 <= shleifNo && shleifNo <= 8) && (address != 0))
{
device.DriverUID = device.Driver.UID;
var shleif = KauDevice.Children.FirstOrDefault(x => (x.DriverType == GKDriverType.RSR2_KAU_Shleif) && x.IntAddress == shleifNo);
shleif.Children.Add(device);
device.IntAddress = (byte)(address % 256);
return true;
}
device.Driver = GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.KAUIndicator);
device.DriverUID = device.Driver.UID;
device.IntAddress = 1;
KauDevice.Children.Add(device);
return true;
}
示例13: CreateDevice
GKDevice CreateDevice(GKDriverType deviceDriverType)
{
var deviceDriver = GKManager.Drivers.FirstOrDefault(x => x.DriverType == deviceDriverType);
var device = new GKDevice { DriverUID = deviceDriver.UID };
AlsDevice.Children.Add(device);
return device;
}
示例14: DevicePropertiesViewModel
public DevicePropertiesViewModel(GKDevice device)
{
Title = "Параметры устройства";
Device = device;
ShortProperties = new List<ShortPropertyViewModel>();
BoolProperties = new List<BoolPropertyViewModel>();
EnumProperties = new List<EnumPropertyViewModel>();
if (Device != null)
{
if (Device.PredefinedName == "Тест")
{
return;
}
foreach (var driverProperty in Device.Driver.Properties.Where(x => x.IsAUParameter && !x.CanNotEdit))
{
switch (driverProperty.DriverPropertyType)
{
case GKDriverPropertyTypeEnum.IntType:
ShortProperties.Add(new ShortPropertyViewModel(driverProperty, Device));
break;
case GKDriverPropertyTypeEnum.BoolType:
BoolProperties.Add(new BoolPropertyViewModel(driverProperty, Device));
break;
case GKDriverPropertyTypeEnum.EnumType:
EnumProperties.Add(new EnumPropertyViewModel(driverProperty, Device));
break;
}
}
}
}
示例15: CreateConfiguration
public void CreateConfiguration()
{
GKManager.DeviceLibraryConfiguration = new GKDeviceLibraryConfiguration();
GKManager.DeviceConfiguration = new GKDeviceConfiguration();
var systemDriver = GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.System);
Assert.IsNotNull(systemDriver);
var systemDevice = GKManager.DeviceConfiguration.RootDevice = new GKDevice { Driver = systemDriver, DriverUID = systemDriver.UID };
gkDevice1 = GKManager.AddDevice(systemDevice, GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.GK), 0);
kauDevice11 = GKManager.AddDevice(gkDevice1, GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.RSR2_KAU), 1);
kauDevice12 = GKManager.AddDevice(gkDevice1, GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.RSR2_KAU), 2);
gkDevice2 = GKManager.AddDevice(systemDevice, GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.GK), 0);
kauDevice21 = GKManager.AddDevice(gkDevice2, GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.RSR2_KAU), 1);
kauDevice22 = GKManager.AddDevice(gkDevice2, GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.RSR2_KAU), 2);
GKManager.UpdateConfiguration();
ClientManager.PlansConfiguration = new PlansConfiguration();
ClientManager.PlansConfiguration.AllPlans = new List<Plan>();
ServiceFactory.Initialize(null, null);
ServiceFactory.ResourceService = new MockResourceService();
ServiceFactory.DialogService = MockDialogService = new MockDialogService();
ServiceFactory.MessageBoxService = MockMessageBoxService = new MockMessageBoxService();
ServiceFactory.MenuService = new MenuService(x => { ;});
ServiceFactory.RibbonService = new MockRibbonService();
CreateGroupControllerModule();
}