Пример #1
0
        private SectionViewModel AddSection(string sectionName, ConfigurationSection section,
                                            InitializeContext initializeContext)
        {
            var sectionViewModel = SectionViewModel.CreateSection(builder, sectionName, section);

            SectionInitializer.InitializeSection(sectionViewModel, initializeContext);
            lookup.AddSection(sectionViewModel);
            sections.Add(sectionViewModel);

            return(sectionViewModel);
        }
        ///<summary>
        /// Initializes an instance of DefaultElementCollectionAddCommand.
        /// </summary>
        ///<param name="collection">The collection that will be affected by the add command.</param>
        ///<param name="uiService"><see cref="IUIServiceWpf"/> for displaying messages.</param>
        public DefaultElementCollectionAddCommand(ElementCollectionViewModel collection, IUIServiceWpf uiService)
            : base(uiService)
        {
            this.collection = collection;
            this.section    = collection.ContainingSection;

            if (this.collection.IsPolymorphicCollection)
            {
                childCommands = this.collection.PolymorphicCollectionElementTypes
                                .SelectMany(x => section.CreateCollectionElementAddCommand(x, collection))
                                .OrderBy(x => x.Title)
                                .ToArray();
            }
            else
            {
                childCommands = section.CreateCollectionElementAddCommand(collection.CollectionElementType, collection).ToArray();
            }
        }
Пример #3
0
 public virtual void PropertyDependencyInitialization(SectionViewModel containingSection, IApplicationModel applicationModel)
 {
     this.containingSection = containingSection;
     this.appModel          = applicationModel;
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of <see cref="SectionViewModel"/>.
 /// </summary>
 /// <param name="sectionViewModel">The section view model to act upon.</param>
 /// <param name="uiService">The user-interface service.</param>
 public ToggleExpandedCommand(SectionViewModel sectionViewModel, IUIServiceWpf uiService)
     : base(uiService)
 {
     this.sectionViewModel    = sectionViewModel;
     this.keyGestureConverter = new KeyGestureConverter();
 }
 /// <summary>
 /// Initializes a new instance of <see cref="SectionViewModel"/>.
 /// </summary>
 /// <param name="sectionViewModel">The section view model to act upon.</param>
 /// <param name="uiService">The user-interface service.</param>
 public ToggleExpandedCommand(SectionViewModel sectionViewModel, IUIServiceWpf uiService)
     : base(uiService)
 {
     this.sectionViewModel = sectionViewModel;
 }