Easy way to excecute method after a given delay?

前端 未结 2 1387
清酒与你
清酒与你 2021-02-03 13:20

Is there a easy way to perform a method after a given delay like in iOS out of the box?

On iPhone I would do this:

[self performSelector:@selector(connectS

2条回答
  •  庸人自扰
    2021-02-03 14:12

    You can use the Reactive Extensions for WP7 to observe on a timer:

    Observable
      .Timer(TimeSpan.FromMilliseconds(2500))
      .SubscribeOnDispatcher()
      .Subscribe(_ =>
        {
          NavigationService.GoBack();
        });
    

    Given the brevity of this code, I don't think you'd gain much by creating an extension method for it :) For more information about the Reactive Extensions for WP7, take a look at this MSDN page .

提交回复
热议问题