/// <summary/>
        public CustomEntryBuilder StartEntry(IEnumerable <string> entrySelectedByType = null, IEnumerable <DisplayEntry> entrySelectedByCondition = null)
        {
            var entry = new CustomControlEntry
            {
                SelectedBy = EntrySelectedBy.Get(entrySelectedByType, entrySelectedByCondition)
            };

            _control.Entries.Add(entry);
            return(new CustomEntryBuilder(this, entry));
        }
        internal CustomControl(ComplexControlBody body, ViewDefinition viewDefinition)
        {
            // viewDefinition can be null for nested controls
            if (viewDefinition != null)
            {
                OutOfBand = viewDefinition.outOfBand;
                GroupBy = PSControlGroupBy.Get(viewDefinition.groupBy);
            }

            Entries = new List<CustomControlEntry>();

            // Default entry
            var cce = new CustomControlEntry(body.defaultEntry);
            Entries.Add(cce);

            foreach (var entry in body.optionalEntryList)
            {
                cce = new CustomControlEntry(entry);
                Entries.Add(cce);
            }
        }
        internal CustomControl(ComplexControlBody body, ViewDefinition viewDefinition)
        {
            // viewDefinition can be null for nested controls
            if (viewDefinition != null)
            {
                OutOfBand = viewDefinition.outOfBand;
                GroupBy   = PSControlGroupBy.Get(viewDefinition.groupBy);
            }

            Entries = new List <CustomControlEntry>();

            // Default entry
            var cce = new CustomControlEntry(body.defaultEntry);

            Entries.Add(cce);

            foreach (var entry in body.optionalEntryList)
            {
                cce = new CustomControlEntry(entry);
                Entries.Add(cce);
            }
        }
 internal CustomEntryBuilder(CustomControlBuilder controlBuilder, CustomControlEntry entry)
 {
     _entryStack = new Stack <List <CustomItemBase> >();
     _entryStack.Push(entry.CustomItems);
     _controlBuilder = controlBuilder;
 }
示例#5
0
 private ComplexControlEntryDefinition LoadComplexControlEntryDefinitionFromObjectModel(CustomControlEntry entry, int viewIndex, string typeName)
 {
     var cced = new ComplexControlEntryDefinition();
     if (entry.SelectedBy != null)
     {
         cced.appliesTo = LoadAppliesToSectionFromObjectModel(entry.SelectedBy.TypeNames, entry.SelectedBy.SelectionCondition);
     }
     foreach (var item in entry.CustomItems)
     {
         cced.itemDefinition.formatTokenList.Add(LoadFormatTokenFromObjectModel(item, viewIndex, typeName));
     }
     return cced;
 }
 /// <summary/>
 public CustomEntryBuilder StartEntry(IEnumerable<string> entrySelectedByType = null, IEnumerable<DisplayEntry> entrySelectedByCondition = null)
 {
     var entry = new CustomControlEntry
     {
         SelectedBy = EntrySelectedBy.Get(entrySelectedByType, entrySelectedByCondition)
     };
     _control.Entries.Add(entry);
     return new CustomEntryBuilder(this, entry);
 }
 internal CustomEntryBuilder(CustomControlBuilder controlBuilder, CustomControlEntry entry)
 {
     _entryStack = new Stack<List<CustomItemBase>>();
     _entryStack.Push(entry.CustomItems);
     _controlBuilder = controlBuilder;
 }