/// <summary>
        /// Removes a value row
        /// </summary>
        /// <param name="value">The associated <see cref="RequirementsContainerParameterValue"/> to remove</param>
        private void RemoveValue(RelationshipParameterValue value)
        {
            var row = this.simpleParameters.ContainedRows.SingleOrDefault(x => x.Thing == value);

            if (row != null)
            {
                this.simpleParameters.ContainedRows.RemoveAndDispose(row);
            }
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RelationshipParameterValueRowViewModel"/> class
 /// </summary>
 /// <param name="parameterValue">The <see cref="RelationshipParameterValue"/> associated with this row </param>
 /// <param name="session">The session</param>
 /// <param name="containerViewModel">The container <see cref="IViewModelBase{T}"/></param>
 public RelationshipParameterValueRowViewModel(RelationshipParameterValue parameterValue, ISession session, IViewModelBase <Thing> containerViewModel)
     : base(parameterValue, session, containerViewModel)
 {
     this.PossibleScales = new ReactiveList <MeasurementScale>();
     this.WhenAnyValue(x => x.Scale).Where(x => x != null).Subscribe(
         x =>
     {
         if (!this.Thing.IsCached())
         {
             this.Thing.Scale = x;
         }
     });
     this.UpdateProperties();
 }
        /// <summary>
        /// Serialize the <see cref="RelationshipParameterValue"/>
        /// </summary>
        /// <param name="relationshipParameterValue">The <see cref="RelationshipParameterValue"/> to serialize</param>
        /// <returns>The <see cref="JObject"/></returns>
        private JObject Serialize(RelationshipParameterValue relationshipParameterValue)
        {
            var jsonObject = new JObject();

            jsonObject.Add("classKind", this.PropertySerializerMap["classKind"](Enum.GetName(typeof(CDP4Common.CommonData.ClassKind), relationshipParameterValue.ClassKind)));
            jsonObject.Add("excludedDomain", this.PropertySerializerMap["excludedDomain"](relationshipParameterValue.ExcludedDomain.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("excludedPerson", this.PropertySerializerMap["excludedPerson"](relationshipParameterValue.ExcludedPerson.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("iid", this.PropertySerializerMap["iid"](relationshipParameterValue.Iid));
            jsonObject.Add("modifiedOn", this.PropertySerializerMap["modifiedOn"](relationshipParameterValue.ModifiedOn));
            jsonObject.Add("parameterType", this.PropertySerializerMap["parameterType"](relationshipParameterValue.ParameterType));
            jsonObject.Add("revisionNumber", this.PropertySerializerMap["revisionNumber"](relationshipParameterValue.RevisionNumber));
            jsonObject.Add("scale", this.PropertySerializerMap["scale"](relationshipParameterValue.Scale));
            jsonObject.Add("thingPreference", this.PropertySerializerMap["thingPreference"](relationshipParameterValue.ThingPreference));
            jsonObject.Add("value", this.PropertySerializerMap["value"](relationshipParameterValue.Value));
            return(jsonObject);
        }
Пример #4
0
        /// <summary>
        /// Add a <see cref="RelationshipParameterValue"/> to a <see cref="RelationshipParameterValue"/>
        /// </summary>
        /// <param name="relationship">The <see cref="RelationshipParameterValue"/></param>
        /// <param name="value">The <see cref="AttributeValue"/></param>
        private void SetParameterValue(BinaryRelationship relationship, AttributeValue value)
        {
            if (this.datatypeDefMap[value.AttributeDefinition.DatatypeDefinition].ParameterType == null)
            {
                throw new InvalidOperationException("The datatype-definition of an AttributeValue that is mapped to a Parameter-Value shall be mapped to a ParameterType.");
            }

            var theValue   = this.GetAttributeValue(value);
            var valueArray = new string[] { theValue };

            // TODO get mapped scale
            var simpleParameter = new RelationshipParameterValue
            {
                ParameterType = this.datatypeDefMap[value.AttributeDefinition.DatatypeDefinition].ParameterType
            };

            simpleParameter.Value = new ValueArray <string>(valueArray);
            relationship.ParameterValue.Add(simpleParameter);
        }
 /// <summary>
 /// Add an Parameter Value row view model to the list of <see cref="ParameterValue"/>
 /// </summary>
 /// <param name="parameterValue">
 /// The <see cref="ParameterValue"/> that is to be added
 /// </param>
 private RelationshipParameterValueRowViewModel AddParameterValueRowViewModel(RelationshipParameterValue parameterValue)
 {
     return(new RelationshipParameterValueRowViewModel(parameterValue, this.Session, this));
 }
Пример #6
0
        /// <summary>
        /// Add a row representing a new <see cref="RelationshipParameterValue"/>
        /// </summary>
        /// <param name="value">The associated <see cref="RelationshipParameterValue"/></param>
        private void AddValue(RelationshipParameterValue value)
        {
            var row = new RelationshipParameterValueRowViewModel(value, this.Session, this);

            this.simpleParameters.ContainedRows.Add(row);
        }