Exemplo n.º 1
0
        /// <summary>
        /// Initialize the framework context in preparation for usage. This method must be called before the framework can be used.
        /// </summary>
        public void Initialize()
        {
            if (disposed)
            {
                throw new ObjectDisposedException("this");
            }

            if (initialized)
            {
                throw new InvalidOperationException("Cannot initialize the framework more than once");
            }

            initialized = true;

            componentContext.Register <IComponentContext>(componentContext);
            componentContext.Register <IConfigurationContext>(configurationContext);
            componentContext.Register <IFrameworkContext>(this);
            componentContext.Register <ITaskContext>(taskContext);

            configurationContext.Initialize();
            componentContext.Initialize();
            taskContext.Initialize();
        }