public virtual Asynchronous.IAsyncResult Execute(Action action) { AsyncResult result = new AsyncResult(true); Executors.RunAsyncNoReturn(() => { try { if (result.IsCancellationRequested) { result.SetCancelled(); return; } action(); result.SetResult(); } catch (Exception e) { result.SetException(e); } }); return(result); }
public virtual IAsyncResult <TResult> Execute <TResult>(Func <TResult> func) { AsyncResult <TResult> result = new AsyncResult <TResult>(true); Executors.RunAsyncNoReturn(() => { try { if (result.IsCancellationRequested) { result.SetCancelled(); return; } TResult tr = func(); result.SetResult(tr); } catch (Exception e) { result.SetException(e); } }); return(result); }
public virtual IProgressResult <TProgress, TResult> RunOnCoroutine <TProgress, TResult>(Func <IProgressPromise <TProgress, TResult>, IEnumerator> func) { return(Executors.RunOnCoroutine(func)); }
public virtual Asynchronous.IAsyncResult RunOnCoroutine(Func <IPromise, IEnumerator> func) { return(Executors.RunOnCoroutine(func)); }
public virtual Asynchronous.IAsyncResult RunOnCoroutine(IEnumerator routine) { return(Executors.RunOnCoroutine(routine)); }
public virtual void RunOnCoroutineNoReturn(IEnumerator routine) { Executors.RunOnCoroutineNoReturn(routine); }
public virtual TResult RunOnMainThread <TResult>(Func <TResult> func) { return(Executors.RunOnMainThread(func)); }
public virtual void RunOnMainThread(Action action, bool waitForExecution = false) { Executors.RunOnMainThread(action, waitForExecution); }