public void InitializeAvailableDevices(GKGuardZone zone) { AvailableDevices = new ObservableCollection<GuardZoneDeviceViewModel>(); foreach (var device in GKManager.Devices) { if (device.Driver.HasGuardZone && !zone.GuardZoneDevices.Any(x => x.DeviceUID == device.UID)) { if (device.GuardZones.Count > 0 || (device.IsInMPT && !GlobalSettingsHelper.GlobalSettings.ShowMPTsDevices) || (device.ZoneUIDs.Count > 0 && !GlobalSettingsHelper.GlobalSettings.ShowZonesDevices) || (device.Door != null && !GlobalSettingsHelper.GlobalSettings.ShowDoorsDevices)) continue; var guardZoneDevice = new GKGuardZoneDevice { DeviceUID = device.UID, Device = device }; var deviceViewModel = new GuardZoneDeviceViewModel(guardZoneDevice); AvailableDevices.Add(deviceViewModel); } } OnPropertyChanged(() => AvailableDevices); SelectedAvailableDevice = AvailableDevices.FirstOrDefault(); }
public void Initialize(GKGuardZone zone) { Zone = zone; Devices = new ObservableCollection<GuardZoneDeviceViewModel>(); foreach (var device in GKManager.Devices) { if (device.DriverType == GKDriverType.RSR2_GuardDetector || device.DriverType == GKDriverType.RSR2_GuardDetectorSound || device.DriverType == GKDriverType.RSR2_HandGuardDetector || device.DriverType == GKDriverType.RSR2_AM_1 || device.DriverType == GKDriverType.RSR2_MAP4 || device.Driver.IsCardReaderOrCodeReader) { var guardZoneDevice = Zone.GuardZoneDevices.FirstOrDefault(x => x.DeviceUID == device.UID); if (guardZoneDevice != null) { var deviceViewModel = new GuardZoneDeviceViewModel(guardZoneDevice); Devices.Add(deviceViewModel); } } } OnPropertyChanged(() => Devices); SelectedDevice = Devices.FirstOrDefault(); }