Пример #1
0
 private void UpdateMethodInfo()
 {
     this.methodDescriptors.Clear();
     if (this.Target != null && !string.IsNullOrEmpty(this.MethodName))
     {
         Type         type    = this.Target.GetType();
         MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public);
         for (int i = 0; i < methods.Length; i++)
         {
             MethodInfo methodInfo = methods[i];
             if (this.IsMethodValid(methodInfo))
             {
                 ParameterInfo[] parameters = methodInfo.GetParameters();
                 if (CallMethodAction.AreMethodParamsValid(parameters))
                 {
                     this.methodDescriptors.Add(new CallMethodAction.MethodDescriptor(methodInfo, parameters));
                 }
             }
         }
         this.methodDescriptors = this.methodDescriptors.OrderByDescending(delegate(CallMethodAction.MethodDescriptor methodDescriptor)
         {
             int num = 0;
             if (methodDescriptor.HasParameters)
             {
                 Type type2 = methodDescriptor.SecondParameterType;
                 while (type2 != typeof(EventArgs))
                 {
                     num++;
                     type2 = type2.BaseType;
                 }
             }
             return(methodDescriptor.ParameterCount + num);
         }).ToList <CallMethodAction.MethodDescriptor>();
     }
 }
Пример #2
0
        private static void OnTargetObjectChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            CallMethodAction callMethodAction = (CallMethodAction)sender;

            callMethodAction.UpdateMethodInfo();
        }