我正在寻找一种在延迟n秒后执行动作/方法的简单方法.我发现了一些例子,但它们在我的上一个平台iOS上看起来过于复杂,只是
[self performSelector:@selector(methodname) withDelay:3];
Run Code Online (Sandbox Code Playgroud)
任何提示或代码片段将不胜感激.
您还可以使用Scheduler.Dispatcher来自Microsoft.Phone.Reactive:
Scheduler.Dispatcher.Schedule(MethodName, TimeSpan.FromSeconds(5));
private void MethodName()
{
// This happens 5 seconds later (on the UI thread)
}
Run Code Online (Sandbox Code Playgroud)