BeginExecute() публичный статический Метод

Executes a coroutine.
public static BeginExecute ( IEnumerator coroutine, ActionExecutionContext context = null, EventHandler callback = null ) : void
coroutine IEnumerator The coroutine to execute.
context ActionExecutionContext The context to execute the coroutine within.
callback EventHandler The completion callback for the coroutine.
Результат void
Пример #1
0
        /// <summary>
        /// Called by the bootstrapper's constructor at runtime to start the framework.
        /// </summary>B
        protected virtual void StartRuntime()
        {
            EventAggregator.HandlerResultProcessing = (target, result) =>
            {
                var task = result as Task;
                if (task != null)
                {
                    result = new IResult[] { task.AsResult() };
                }

                var coroutine = result as IEnumerable <IResult>;
                if (coroutine != null)
                {
                    var viewAware = target as IViewAware;
                    var view      = viewAware != null?viewAware.GetView() : null;

                    var context = new CoroutineExecutionContext {
                        Target = target, View = view
                    };

                    Coroutine.BeginExecute(coroutine.GetEnumerator(), context);
                }
            };

            AssemblySourceCache.Install();
            AssemblySource.Instance.AddRange(SelectAssemblies());

            Configure();

            IoC.GetInstance     = GetInstance;
            IoC.GetAllInstances = GetAllInstances;
            IoC.BuildUp         = BuildUp;
        }
Пример #2
0
        /// <summary>
        /// Called by the bootstrapper's constructor at runtime to start the framework.
        /// </summary>
        protected virtual void StartRuntime()
        {
            Execute.InitializeWithDispatcher();
            EventAggregator.DefaultPublicationThreadMarshaller = Execute.OnUIThread;

            EventAggregator.HandlerResultProcessing = (target, result) => {
                var coroutine = result as IEnumerable <IResult>;
                if (coroutine != null)
                {
                    var viewAware = target as IViewAware;
                    var view      = viewAware != null?viewAware.GetView() : null;

                    var context = new ActionExecutionContext {
                        Target = target, View = (DependencyObject)view
                    };

                    Coroutine.BeginExecute(coroutine.GetEnumerator(), context);
                }
            };

            AssemblySource.Instance.AddRange(SelectAssemblies());

            if (useApplication)
            {
                Application = Application.Current;
                PrepareApplication();
            }

            Configure();
            IoC.GetInstance     = GetInstance;
            IoC.GetAllInstances = GetAllInstances;
            IoC.BuildUp         = BuildUp;
        }
Пример #3
0
        /// <summary>
        /// Called by the bootstrapper's constructor at runtime to start the framework.
        /// </summary>
        protected virtual void StartRuntime()
        {
            Execute.InitializeWithDispatcher();
            EventAggregator.DefaultPublicationThreadMarshaller = Execute.OnUIThread;

            EventAggregator.HandlerResultProcessing = (target, result) => {
#if !SILVERLIGHT || SL5 || WP8
                var task = result as System.Threading.Tasks.Task;
                if (task != null)
                {
                    result = new IResult[] { task.AsResult() };
                }
#endif

                var coroutine = result as IEnumerable <IResult>;
                if (coroutine != null)
                {
                    var viewAware = target as IViewAware;
                    var view      = viewAware != null?viewAware.GetView() : null;

                    var context = new ActionExecutionContext {
                        Target = target, View = (DependencyObject)view
                    };

                    Coroutine.BeginExecute(coroutine.GetEnumerator(), context);
                }
            };

            AssemblySource.Instance.AddRange(SelectAssemblies());

            PrepareApplication();
            Configure();

            IoC.GetInstance     = GetInstance;
            IoC.GetAllInstances = GetAllInstances;
            IoC.BuildUp         = BuildUp;
        }