Action action = new Action(() =>
                {
                    Thread.Sleep(5000);
                });

            var Async = Observable.FromAsyncPattern(action.BeginInvoke, action.EndInvoke);
            Observable.Timeout(Async.Invoke(), DateTimeOffset.Now.AddSeconds(3)).ObserveOnDispatcher().Subscribe(it =>
                {
                    MessageBox.Show("执行完毕");
                }, ex =>
                    {
                        MessageBox.Show("超时");
                    });
            

相关文章:

  • 2021-09-12
  • 2022-12-23
  • 2021-09-21
  • 2023-02-08
  • 2022-12-23
  • 2022-02-08
  • 2021-11-24
  • 2021-05-23
猜你喜欢
  • 2021-11-04
  • 2021-10-22
  • 2021-11-01
  • 2022-12-23
  • 2021-07-14
相关资源
相似解决方案