Esempio n. 1
0
 //经过selector选择过滤
 public void Intercept(IInvocation invocation)
 {
     invocation.Proceed();
     if (invocation.Method.Name.StartsWith("set_"))
     {
         var methodName = invocation.Method.Name.Substring(4);
         if (NotifyProperties.ContainsKey(methodName))
         {
             var property = NotifyProperties[methodName];
             if (IsRecordable)
             {
                 property.IsChanged = true;
             }
             if (property.PropertyElement.RelationType == RelationType.OneToMany ||
                 property.PropertyElement.RelationType == RelationType.ManyToMany)
             {
                 var val = property.PropertyElement.PropertyInfo.GetValue(invocation.Proxy);
                 if (val != null)
                 {
                     ((INotifyCollectionChanged)val).CollectionChanged += (o, e) => {
                         if (IsRecordable)
                         {
                             if (e.Action == NotifyCollectionChangedAction.Move)
                             {
                                 return;
                             }
                             property.OperatersList.Add(e);
                         }
                     };
                 }
             }
         }
     }
 }
Esempio n. 2
0
 public NotifyRequest(Device device, string from, Mode mode) : this()
 {
     To         = device.DeviceId;
     From       = from;
     Properties = new NotifyProperties(mode);
 }