Exemple #1
0
        protected Component(BootstrapHelper helper)
        {
            _config   = helper.GetConfig();
            _parent   = helper.GetParent();
            _implicit = GetOutputStack().Count > 0;

            // Get any component override(s)
            ComponentOverride componentOverride = null;
            Type thisType = GetType();

            foreach (KeyValuePair <Type, Func <BootstrapConfig, Component, ComponentOverride> > match
                     in Config.ComponentOverrides.Where(x => x.Key.IsAssignableFrom(thisType)))
            {
                ComponentOverride lastComponentOverride = componentOverride;
                componentOverride = match.Value(Config, this);
                componentOverride.BaseStartAction  = OnStart;
                componentOverride.BaseFinishAction = OnFinish;
                if (lastComponentOverride != null)
                {
                    // If this is an override higher up the hierarchy, redirect the lower override to call this one
                    lastComponentOverride.BaseStartAction  = componentOverride.OnStart;
                    lastComponentOverride.BaseFinishAction = componentOverride.OnFinish;
                }
                _componentOverrides.Enqueue(componentOverride);
            }
        }