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


C# GK.GKDevice类代码示例

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

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

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

示例4: GKState

		public GKState(GKDevice device)
			: this()
		{
			Device = device;
			UID = device.UID;
			BaseObjectType = GKBaseObjectType.Device;
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:7,代码来源:GKState.cs

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

示例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, "На КАУ должна отсутствовать логика устройства");
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:7,代码来源:DescriptorsTest.Common.cs

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

示例8: GetTankColor

		public static Color GetTankColor(GKDevice device)
		{
			Color color = Colors.Black;
			if (device != null)
				color = Colors.LightCyan;
			return color;
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:7,代码来源:Helper.cs

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

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

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

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

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

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

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


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