Esempio n. 1
0
        public static void RunTask(EditorTask editorTask, object argument)
        {
            var thread = new Thread(() =>
            {
                object result = null;

                try
                {
                    result = editorTask.GenericTaskFunction(argument);

                    DispatchOnMainThread(() =>
                    {
                        if (editorTask.DoneBlock != null)
                        {
                            editorTask.DoneBlock(result);
                        }

                        if (editorTask.NextTask != null)
                        {
                            RunTask(editorTask.NextTask, argument);
                        }
                    });
                }
                catch (Exception ex)
                {
                    if (editorTask.CatchBlock != null)
                    {
                        editorTask.CatchBlock(ex);
                    }
                    else
                    {
                        DispatchOnMainThread(() =>
                        {
                            throw ex;
                        });
                        return;
                    }
                }
                finally
                {
                    if (editorTask.FinallyBlock != null)
                    {
                        editorTask.FinallyBlock();
                    }
                }
            });

            thread.Start();
        }
Esempio n. 2
0
 public EditorTask <TOutput, TNextOutput> ContinueWith <TNextOutput>(EditorTask <TOutput, TNextOutput> task)
 {
     NextTask = task;
     return(task);
 }