Cysharp / R3

The new future of dotnet/reactive and UniRx.
MIT License
2.1k stars 92 forks source link

Debounce does not work in wpf #193

Closed NeverMorewd closed 3 months ago

NeverMorewd commented 5 months ago

Codes as below

 Observable.EveryValueChanged(this, _ => System.Windows.Forms.Cursor.Position)
     .Debounce(TimeSpan.FromSeconds(2))
     .Subscribe(p => 
     {
         Console.WriteLine($"point=({p.X},{p.Y})");
     });

Console.WriteLine() can not be tiggered.

In addition, the ThrottleFirst worked as the expectation of Debounce

NeverMorewd commented 5 months ago

R3.Wpf

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            //https://github.com/Cysharp/R3?tab=readme-ov-file#wpf
            WpfProviderInitializer.SetDefaultObservableSystem(ex => Debug.WriteLine($"R3 UnhandledException:{ex}"));
        }