Esempio n. 1
0
        public override CustomAction Do(CustomAction customAction)
        {
            CustomAction customAction1 = new CustomAction(() =>
            {
                Console.WriteLine("另一个执行前的方法。");
                customAction.Invoke();
            });

            return(customAction1);
        }
Esempio n. 2
0
        //展示
        public void Show()
        {
            InvokeDelegate invokeDelegate = new InvokeDelegate();
            Type           type           = typeof(InvokeDelegate);
            Type           type1          = invokeDelegate.GetType();
            MethodInfo     method         = type.GetMethod("Do");
            CustomAction   customAction   = new CustomAction(() =>
            {
                method.Invoke(invokeDelegate, null);
            });

            if (method.IsDefined(typeof(AbstractAttribute), true))
            {
                IEnumerable <AbstractAttribute> items = method.GetCustomAttributes <AbstractAttribute>();
                foreach (var item in items.ToArray().Reverse())
                {
                    customAction = item.Do(customAction);
                }
            }
            customAction.Invoke();
        }
Esempio n. 3
0
 public string Replace(string html)
 {
     return(CustomAction.Invoke(html));
 }
Esempio n. 4
0
 public void Execute(object parameter)
 {
     CustomAction?.Invoke(parameter);
 }