static HeldDevices() { BufferedUpdateStream = new Subject<Tuple<List<string>, List<string>>>(); BufferedUpdateStream .DelayBuffer(TimeSpan.FromMilliseconds(500)) .SubscribeOn(TaskPoolScheduler.Default) .Subscribe(ProcessUpdates); // Subscribe to Repository Notifications RepositoryMonitor.StreamBeforeCommit.Where(e => (e.EntityType == typeof(Job) && (e.EventType == RepositoryMonitorEventType.Added || e.EventType == RepositoryMonitorEventType.Deleted || (e.EventType == RepositoryMonitorEventType.Modified && e.ModifiedProperties.Any(p => MonitorJobProperties.Contains(p)))) ) || (e.EntityType == typeof(JobMetaNonWarranty) && (e.EventType == RepositoryMonitorEventType.Added || e.EventType == RepositoryMonitorEventType.Deleted || (e.EventType == RepositoryMonitorEventType.Modified && e.ModifiedProperties.Any(p => MonitorJobMetaNonWarrantyProperties.Contains(p)))) ) || (e.EntityType == typeof(Device) && (e.EventType == RepositoryMonitorEventType.Modified && e.ModifiedProperties.Any(p => MonitorDeviceProperties.Contains(p))) ) || (e.EntityType == typeof(DeviceProfile) && (e.EventType == RepositoryMonitorEventType.Modified && e.ModifiedProperties.Any(p => MonitorDeviceProfileProperties.Contains(p))) ) || (e.EntityType == typeof(User) && (e.EventType == RepositoryMonitorEventType.Modified && e.ModifiedProperties.Any(p => MonitorUserProperties.Contains(p))) ) ) .Subscribe(RepositoryEvent); }