ActionTask.cs
22 lines
| 626 B
| text/x-csharp
|
CSharpLexer
/ Implab / ActionTask.cs
cin
|
r145 | using System; | ||
namespace Implab { | ||||
cin
|
r244 | public class ActionTask : ActionTaskBase, IResolvable { | ||
cin
|
r145 | readonly Action m_task; | ||
cin
|
r149 | public ActionTask(Action task, Action<Exception> error, Action<Exception> cancel, bool autoCancellable) : base(error,cancel, autoCancellable) { | ||
cin
|
r145 | m_task = task; | ||
} | ||||
public void Resolve() { | ||||
if (m_task != null && LockCancelation()) { | ||||
try { | ||||
m_task(); | ||||
SetResult(); | ||||
} catch(Exception err) { | ||||
cin
|
r196 | SetErrorInternal(err); | ||
cin
|
r145 | } | ||
} | ||||
} | ||||
} | ||||
} | ||||