/// <summary>
        /// Copies all the non-null properties of this model 
        /// marked with JsonProperty attributes to another model
        /// </summary>
        /// <param name="other"></param>
        public virtual void CopyTo(CloudsdaleModel other)
        {
            var properties = GetType().GetRuntimeProperties();
            var targetType = other.GetType();
            foreach (var property in properties)
            {
                var attribute = property.GetCustomAttribute<JsonPropertyAttribute>();
                if (attribute == null) continue;

                var value = property.GetValue(this);
                if (value == null) return;
                var targetProperty = targetType.GetRuntimeProperty(property.Name);
                targetProperty.SetValue(other, value);
            }
        }
 /// <summary>
 /// Copies the properties from this resource to another
 /// </summary>
 /// <param name="other">The other resource</param>
 public override void CopyTo(CloudsdaleModel other)
 {
     base.CopyTo(other);
     LastUpdated = DateTime.Now;
 }
Example #3
0
 public bool CanMerge(CloudsdaleModel other)
 {
     var otherMessage = (Message)other;
     return User.Id == otherMessage.User.Id && !SlashMeFormat.IsMatch(Content) && !SlashMeFormat.IsMatch(otherMessage.Content);
 }
Example #4
0
        public void Merge(CloudsdaleModel other)
        {
            _messages.Add((Message)other);
            OnPropertyChanged("Messages");
            OnPropertyChanged("AllDrops");
            OnPropertyChanged("FinalTimestamp");
            

            other.PropertyChanged += (sender, args) => OnPropertyChanged(args.PropertyName);
        }
 public DefaultMetadataObject(CloudsdaleModel model)
 {
     Model = model;
 }
 public IMetadataObject CreateNew(CloudsdaleModel model)
 {
     return new DefaultMetadataObject(model);
 }
Example #7
0
 public UIMetadata(CloudsdaleModel model)
 {
     this.model = model;
 }