我在C#脚本中用到了异步流程(https://getquicker.net/SubProgram?id=a1d594df-9c2f-4d5f-af42-08de92afb6f8)
async public static void Exec(Quicker.Public.IStepContext context)
{
WebView2 wv = context.GetVarValue("webView") as WebView2;
try {
await wv.EnsureCoreWebView2Async();
CoreWebView2PrintSettings printSettings = wv.CoreWebView2.Environment.CreatePrintSettings();
...
CoreWebView2PrintStatus status = await wv.CoreWebView2.PrintAsync(printSettings); // 这步只有异步方法
....
} finally {
Window.GetWindow(wv).Close();
}
}
我想根据status返回的结果进行操作。我目前想到可以通过RunSpAsync的方法,通过子程序回调进行处理,但是这样所有后续指令都要在子程序里实现,而且没有办法返回结果。请问有没有办法可以在Quicker的主步骤流程里等待异步?