public ExposedMethodField CreateExposedMethodButton(ExposedMethod method, Getter getter, Setter setter)
        {
            ExposedMethodField methodDrawer = (ExposedMethodField)Inspector.CreateDrawerForType(typeof(ExposedMethod), drawArea, Depth + 1, false);

            if (methodDrawer != null)
            {
                methodDrawer.BindTo(typeof(ExposedMethod), string.Empty, getter, setter);
                methodDrawer.SetBoundMethod(method);

                exposedMethods.Add(methodDrawer);
            }

            return(methodDrawer);
        }
示例#2
0
        private void GenerateMethods()
        {
            ExposedMethod[] methods = BoundVariableType.GetExposedMethods();
            if (methods != null)
            {
                bool isInitialized = Value != null && !Value.Equals(null);
                for (int i = 0; i < methods.Length; i++)
                {
                    ExposedMethod method = methods[i];
                    if ((isInitialized && method.VisibleWhenInitialized) || (!isInitialized && method.VisibleWhenUninitialized))
                    {
                        ExposedMethodField methodDrawer = (ExposedMethodField)Inspector.CreateDrawerForType(typeof(ExposedMethod), drawArea, Depth + 1, false);
                        if (methodDrawer != null)
                        {
                            methodDrawer.BindTo(typeof(ExposedMethod), string.Empty, () => Value, (value) => Value = value);
                            methodDrawer.SetBoundMethod(method);

                            exposedMethods.Add(methodDrawer);
                        }
                    }
                }
            }
        }