Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RequirementContainerRowViewModel{T}"/> class
 /// </summary>
 /// <param name="reqContainer">The <see cref="RequirementsSpecification"/></param>
 /// <param name="session">The <see cref="ISession"/></param>
 /// <param name="containerViewModel">The container <see cref="IViewModelBase{T}"/></param>
 /// <param name="topNode">The top level node for this row</param>
 protected RequirementContainerRowViewModel(T reqContainer, ISession session, IViewModelBase <Thing> containerViewModel, RequirementsSpecificationRowViewModel topNode = null)
     : base(reqContainer, session, containerViewModel)
 {
     this.simpleParameters = new CDP4Composition.FolderRowViewModel("Simple Parameter Values", "Simple Parameter Values", this.Session, this);
     this.ContainedRows.Add(this.simpleParameters);
     this.TopParentRow = topNode ?? this as RequirementsSpecificationRowViewModel;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BinaryRelationshipRowViewModel"/> class
 /// </summary>
 /// <param name="relationship">The <see cref="BinaryRelationship"/> associated with this row</param>
 /// <param name="session">The session</param>
 /// <param name="containerViewModel">The container view-model</param>
 public BinaryRelationshipRowViewModel(BinaryRelationship relationship, ISession session, IViewModelBase <Thing> containerViewModel)
     : base(relationship, session, containerViewModel)
 {
     this.simpleParameters = new CDP4Composition.FolderRowViewModel("Simple Parameter Values", "Simple Parameter Values", this.Session, this);
     this.ContainedRows.Add(this.simpleParameters);
     this.UpdateProperties();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RequirementRowViewModel"/> class
        /// </summary>
        /// <param name="req">The requirement</param>
        /// <param name="session">The Session</param>
        /// <param name="containerViewModel">The container <see cref="IViewModelBase{T}"/></param>
        public RequirementRowViewModel(Requirement req, ISession session, IViewModelBase <Thing> containerViewModel)
            : base(req, session, containerViewModel)
        {
            this.simpleParameters      = new FolderRowViewModel("Simple Parameter Values", "Simple Parameter Values", this.Session, this);
            this.parametricConstraints = new FolderRowViewModel("Parametric Constraints", "Parametric Constraints", this.Session, this);

            this.ContainedRows.Add(this.simpleParameters);
            this.ContainedRows.Add(this.parametricConstraints);

            this.UpdateProperties();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EngineeringModelSetupRowViewModel"/> class
        /// </summary>
        /// <param name="engineeringModelSetup">
        /// The engineering Model Setup.
        /// </param>
        /// <param name="session">
        /// The session.
        /// </param>
        /// <param name="containerViewModel">
        /// The container <see cref="IViewModelBase{T}"/>
        /// </param>
        public EngineeringModelSetupRowViewModel(EngineeringModelSetup engineeringModelSetup, ISession session, IViewModelBase <Thing> containerViewModel)
            : base(engineeringModelSetup, session, containerViewModel)
        {
            this.participantFolderRow    = new FolderRowViewModel("Participants", "Participants", this.Session, this);
            this.iterationSetupFolderRow = new FolderRowViewModel("Iterations", "Iterations", this.Session, this);
            this.activeDomainFolderRow   = new FolderRowViewModel("Active Domains", "Active Domains", this.Session, this);

            this.ContainedRows.Add(this.participantFolderRow);
            this.ContainedRows.Add(this.iterationSetupFolderRow);
            this.ContainedRows.Add(this.activeDomainFolderRow);

            this.UpdateProperties();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Compute the rows to remove and to add from a <see cref="IEnumerable{TThing}"/> in the <paramref name="folderRow"/> list
        /// </summary>
        /// <typeparam name="TThing">The type of <see cref="Thing"/> represented by the rows</typeparam>
        /// <param name="currentThings">The current <see cref="IEnumerable{TThing}"/> that shall be represented</param>
        /// <param name="folderRow">The <see cref="FolderRowViewModel"/> that contains the rows representing the <see cref="TThing"/></param>
        /// <param name="createRowMethod">The method that instantiates and adds the rows to the <see cref="ContainedRows"/> list</param>
        protected void ComputeRows <TThing>(IEnumerable <TThing> currentThings, CDP4Composition.FolderRowViewModel folderRow, Func <TThing, IRowViewModelBase <TThing> > createRowMethod) where TThing : Thing
        {
            var current = currentThings.ToList();

            var existingRowThing = folderRow.ContainedRows.Where(x => x.Thing is TThing).Select(x => (TThing)x.Thing).ToList();
            var newThing         = current.Except(existingRowThing).ToList();
            var oldThing         = existingRowThing.Except(current).ToList();

            foreach (var thing in oldThing)
            {
                var row = folderRow.ContainedRows.SingleOrDefault(rowViewModel => rowViewModel.Thing == thing);
                if (row != null)
                {
                    folderRow.ContainedRows.RemoveAndDispose(row);
                }
            }

            foreach (var thing in newThing)
            {
                var row = createRowMethod(thing);
                folderRow.ContainedRows.Add(row);
            }
        }