Пример #1
0
        /// <summary>
        /// Initializes a new data diff element object with the given base value.
        /// </summary>
        /// <param name="owningObject">The object containing the diff element.</param>
        /// <param name="baseValue">The base value of the diff element.</param>
        public DiffElement(DiffElementContainer owningObject, T baseValue)
        {
            // Save owning object
            _owningObject = owningObject;

            // Remember base value, set as current value ("modified" flag updated automatically)
            _baseValue = baseValue;

            // Ignore warnings here, the virtual property is used to properly assign PropertyChanged events in derived classes.
            // As long as these don't have any possibly uninitialized private members, this is safe.
            Value = baseValue;
        }
Пример #2
0
 /// <summary>
 /// Initializes a new data diff element object with the given base value.
 /// </summary>
 /// <param name="owningObject">The object containing the diff element.</param>
 /// <param name="baseResourceCostEntry">The base value of the diff element.</param>
 public ResourceCostEntryDiffElement(DiffElementContainer owningObject, ResourceCostEntry baseResourceCostEntry)
     : base(owningObject, baseResourceCostEntry)
 {
     // Base value should be a copy of the original data element
     _baseValue = new ResourceCostEntry(baseResourceCostEntry.ResourceType, baseResourceCostEntry.Amount, baseResourceCostEntry.Paid);
 }
Пример #3
0
 /// <summary>
 /// Initializes a new data diff element object with the given base value.
 /// </summary>
 /// <param name="owningObject">The object containing the diff element.</param>
 /// <param name="baseAttackArmorEntries">The base value of the diff element.</param>
 public AttackArmorEntryListDiffElement(DiffElementContainer owningObject, List <AttackArmorEntry> baseAttackArmorEntries)
     : base(owningObject, new EquatableObservableCollection <AttackArmorEntry>(baseAttackArmorEntries))
 {
     // Base value should be a copy of the original data element -> deep copy of list
     _baseValue = new EquatableObservableCollection <AttackArmorEntry>(baseAttackArmorEntries.Select(aae => new AttackArmorEntry(aae.ArmorClass, aae.Amount)));
 }