示例#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);
        }
示例#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();
            }
        }
示例#3
0
 virtual public void InitService(Services serviceLocator, System.Action onCompleteCallback)
 {
     ServiceLoader.DoDefaultInitService(this, serviceLocator, onCompleteCallback);
 }
示例#4
0
 public void SetServiceRegistration(ServiceLoader loader)
 {
     loader.SetServiceRegistration(this, this.registrationType);
 }
示例#5
0
 public void SetServiceRegistration(ServiceLoader loader)
 {
     loader.SetServiceRegistration <RegistrationInterface>(this);
 }
 public abstract void SetServiceRegistration(ServiceLoader loader);