Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
 }
Exemplo n.º 7
0
 public virtual TResult RunOnMainThread <TResult>(Func <TResult> func)
 {
     return(Executors.RunOnMainThread(func));
 }
Exemplo n.º 8
0
 public virtual void RunOnMainThread(Action action, bool waitForExecution = false)
 {
     Executors.RunOnMainThread(action, waitForExecution);
 }