Exemplo n.º 1
0
        /// <summary>
        /// Default init op. Handy especially for integration tests
        /// </summary>
        ///
        /// <param name="callback">(optional) callback invoked when all services have completed init
        ///     (services that implement AsyncInitService may not init immediately)
        /// </param>
        public static void Init(Action callback = null)
        {
            if (!Services.exists)
            {
                ServiceLoader.FindOrCreate <ServiceLoader>().LoadServices(true, callback);
                return;
            }

            if (Services.Get.hasInit)
            {
                if (callback != null)
                {
                    callback();
                }
                return;
            }

            if (Services.Get.isInitInProgress)
            {
                if (callback == null)
                {
                    return;
                }

                Services.InitStatusUpdated.AddListener(s => { callback(); });
                return;
            }

            ServiceLoader.FindOrCreate <ServiceLoader>().LoadServices(true, callback);
        }
Exemplo n.º 2
0
        virtual protected void SetServiceRegistrations()
        {
            FindAutowireServiceRegistrations();          // defaults

            FindFactoryServiceRegistrations();           // code based registrations in an app-specific serviceloader

            FindSceneServiceRegistrations();             // serviceloader was preconfigured into a unity scene with children that are service components

            if (ServiceLoader.onAfterSetServiceRegistratonsStatic != null)
            {
                ServiceLoader.onAfterSetServiceRegistratonsStatic(this);
            }

            if (this.onAfterSetServiceRegistratons != null)
            {
                this.onAfterSetServiceRegistratons();
            }
        }
Exemplo n.º 3
0
 virtual public void InitService(Services serviceLocator, System.Action onCompleteCallback)
 {
     ServiceLoader.DoDefaultInitService(this, serviceLocator, onCompleteCallback);
 }
Exemplo n.º 4
0
 public void SetServiceRegistration(ServiceLoader loader)
 {
     loader.SetServiceRegistration(this, this.registrationType);
 }
Exemplo n.º 5
0
 public void SetServiceRegistration(ServiceLoader loader)
 {
     loader.SetServiceRegistration <RegistrationInterface>(this);
 }
 public abstract void SetServiceRegistration(ServiceLoader loader);