Ejemplo n.º 1
0
        /// <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);
            }
        }
Ejemplo n.º 2
0
 /// <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;
 }
Ejemplo n.º 3
0
 public bool CanMerge(CloudsdaleModel other)
 {
     var otherMessage = (Message)other;
     return User.Id == otherMessage.User.Id && !SlashMeFormat.IsMatch(Content) && !SlashMeFormat.IsMatch(otherMessage.Content);
 }
Ejemplo n.º 4
0
        public void Merge(CloudsdaleModel other)
        {
            _messages.Add((Message)other);
            OnPropertyChanged("Messages");
            OnPropertyChanged("AllDrops");
            OnPropertyChanged("FinalTimestamp");
            

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