using System; namespace Implab { public class FuncChainTask : FuncChainTaskBase, IDeferred { readonly Func> m_task; public FuncChainTask(Func> task, Func> error, Func> cancel, bool autoCancellable) : base(error, cancel, autoCancellable){ m_task = task; } public void Resolve(TArg value) { if (m_task != null && LockCancelation()) { try { var operation = m_task(value); operation.On(SetResult, HandleErrorInternal, SetCancelled); CancellationRequested(operation.Cancel); } catch (Exception err) { SetErrorInternal(err); } } } } }