添加项目文件。
This commit is contained in:
28
WaterCloud.Code/Util/AsyncTaskHelper.cs
Normal file
28
WaterCloud.Code/Util/AsyncTaskHelper.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WaterCloud.Code
|
||||
{
|
||||
public class AsyncTaskHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 开始异步任务
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
public static void StartTask(Action action)
|
||||
{
|
||||
try
|
||||
{
|
||||
Action newAction = () =>
|
||||
{ };
|
||||
newAction += action;
|
||||
Task task = new Task(newAction);
|
||||
task.Start();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteWithTime(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user