public void TestAggregate() { var a = new ProgramUseAggregator(); Observable.Interval(TimeSpan.FromMilliseconds(25)).Select(_ => new KeyEventArgs(Keys.A)).Subscribe(a.KeyDown); using (new WinEventHook().ForegroundWindowChanged.Subscribe(a.Window)) using (var intercept = new HumanInterfaceDeviceMonitor()) { intercept.Mouse.Subscribe(a.Mouse); intercept.KeyDown.Subscribe(a.KeyDown); a.ProgramUse.Subscribe(_ => log.Info(_.Details())); ObservableTimeInterval.GetSeconds().Take(10).Wait(); } }
public void TestAggregate() { var a = new InputAggregator(); using (var hidMonitor = new HumanInterfaceDeviceMonitor()) using (new System.Reactive.Disposables.CompositeDisposable( ObservableTimeInterval.GetSeconds().Take(10).Subscribe(a.Time), hidMonitor.Mouse.Subscribe(a.Mouse), hidMonitor.KeyDown.Subscribe(a.KeyDown), hidMonitor.Mouse.ToDistance().Subscribe(_ => log.Info(_)), a.Input.Subscribe(_ => log.Info(_.MouseMove)) )) { a.Input.Wait(); } }