Esempio n. 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);
            }
        }
 internal static void SetColumnClass(this Tag tag, BootstrapConfig config, string prefix, int?value)
 {
     tag.CssClasses.RemoveWhere(x => x.StartsWith(prefix));
     if (value != null)
     {
         if (value < 0)
         {
             value = 1;
         }
         if (value > config.GridColumns)
         {
             value = config.GridColumns;
         }
         tag.CssClasses.Add(prefix + value.Value);
     }
 }