添加DataService为数据服务类,负责数据的加载工作,通过消息来通知DataService更新数据
This commit is contained in:
@@ -14,4 +14,16 @@ public static class TaskExtensions
|
||||
onError?.Invoke(e);
|
||||
}
|
||||
}
|
||||
public static async Task Await<T>(this Task<T> task, Action<Exception> onError = null, Action<T> onComplete = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
T res= await task;
|
||||
onComplete?.Invoke(res);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
onError?.Invoke(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user