using System; namespace Implab { public class ActionChainTask : ActionChainTaskBase, IDeferred { readonly Func m_task; public ActionChainTask(Func task, Func error, Func cancel, bool autoCancellable) : base(error,cancel, autoCancellable) { m_task = task; } public void Resolve(T value) { if (m_task != null && LockCancelation()) { try { var p = m_task(value); p.On(SetResult, HandleErrorInternal, HandleCancelInternal); CancellationRequested(p.Cancel); } catch (OperationCanceledException reason) { HandleCancelInternal(reason); } catch(Exception err) { HandleErrorInternal(err); } } } } }