Ejemplo n.º 1
0
        public void Get <TService>(System.Action <TaskEnding, TService> handler)
            where TService : IService
        {
            IService service = FetchService(typeof(TService));

            if (service != null)
            {
                handler(TaskEnding.Done, (TService)service);
                return;
            }

            //no active provider - see if we can activate a dormant provider

            CoreLogger.LogDebug(_loggerModule, string.Format("adding service {0}, now looking for provider...", typeof(TService).Name));

            _taskFactory.FromEnumerableAction(() =>
                                              ActivateServiceProvider(typeof(TService), s => {
                if (s == null)
                {
                    handler(TaskEnding.Cancelled, default(TService));
                }
                else
                {
                    handler(TaskEnding.Done, (TService)s);
                }
            })).Start(-1);
        }
Ejemplo n.º 2
0
        override public ITask Start(float timeout = -1f)
        {
            _timeout = timeout;

            _startTime = Time.realtimeSinceStartup;
            InvokeStarting();

            _taskFactory.FromEnumerableAction(Controller).Start(result => InvokeDone(result), timeout);

            return(this);
        }
Ejemplo n.º 3
0
 public ITask GetInitializer(IServiceResolver resolver)
 {
     _taskFactory = resolver.TaskFactory;
     return(_taskFactory.FromEnumerableAction(Init));
 }
Ejemplo n.º 4
0
        public ITask GetInitializer(IServiceResolver serviceResolver)
        {
            _taskFactory = serviceResolver.TaskFactory;

            return(_taskFactory.FromEnumerableAction(() => InitService(serviceResolver)));
        }