Exemplo n.º 1
0
        public IOperationDescription ProvideOperation(object instance)
        {
            var figure = instance as IFigure;

            if (figure == null || !CanTearOff(figure))
            {
                return(null);
            }

            return(MethodDescription.Get <TearOffMutation>("TearOffFigure"));
        }
Exemplo n.º 2
0
        private static IEnumerable <IOperationDescription> GetCallableMethods(object editableObject)
        {
            if (editableObject is ICustomMethodProvider)
            {
                return((editableObject as ICustomMethodProvider).GetMethods());
            }

            IEnumerable <MethodInfo> allMethods = editableObject.GetType().GetMethods();

            allMethods = allMethods
                         .Where(m => m.ReturnType == typeof(void) &&
                                !m.IsSpecialName &&
                                m.IsPublic &&
                                m.HasAttribute <PropertyGridVisibleAttribute>());

            var result = allMethods.Select(m => (IOperationDescription)MethodDescription.Create(m));

            return(result);
        }