如何在WinRT(Windows 8 Metro)中的UI线程上运行代码?
该Invoke方法不存在.
我想定义一个在基类中不是异步的虚方法,但它在派生类中是异步的,调用者使用委托调用它(实际上它是由屏幕上的按钮激活的ICommand)我该怎么做.
public class BaseClass
{
BIONESSBindingCommand mLogoffCommand;
public ICommand LogoffCommand
{
get
{
if (mLogoffCommand == null)
{
mLogoffCommand = new BIONESSBindingCommand(
Param => Logoff(), //Command DoWork
Param => true); //Always can execute
}
return mLogoffCommand;
}
}
public virtual Task Logoff()
{
DoLogoff();
return null; //???
}
}
public class DerivedClass : BaseClass
{
public override async Task Logoff()
{
await SomeWoAsyncWork();
base.Logoff(); //Has warninngs
}
}
Run Code Online (Sandbox Code Playgroud) c# asynchronous task-parallel-library async-await windows-runtime