// Draws a representation of the property's value.
        public override void PaintValue(System.Drawing.Design.PaintValueEventArgs e)
        {
            IMethodSelector ts = (IMethodSelector)MathNode.GetService(typeof(IMethodSelector));

            if (ts != null)
            {
                ts.PaintValue(e);
            }
        }
        public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
        {
            IMethodSelector ts = (IMethodSelector)MathNode.GetService(typeof(IMethodSelector));

            if (ts != null)
            {
                return(ts.GetUIEditorStyle(context));
            }
            return(UITypeEditorEditStyle.None);
        }
        // Indicates whether the UITypeEditor supports painting a
        // representation of a property's value.
        public override bool GetPaintValueSupported(System.ComponentModel.ITypeDescriptorContext context)
        {
            IMethodSelector ts = (IMethodSelector)MathNode.GetService(typeof(IMethodSelector));

            if (ts != null)
            {
                return(ts.GetPaintValueSupported(context));
            }
            return(false);
        }
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                edSvc.CloseDropDown();
                IMethodSelector ts = (IMethodSelector)MathNode.GetService(typeof(IMethodSelector));
                if (ts != null)
                {
                    UITypeEditorEditStyle style = ts.GetUIEditorStyle(context);
                    if (style == UITypeEditorEditStyle.DropDown)
                    {
                        IDataSelectionControl dropdown = ts.GetUIEditorDropdown(context, provider, value);
                        if (dropdown != null)
                        {
                            edSvc.DropDownControl((Control)dropdown);
                            object v = dropdown.UITypeEditorSelectedValue;
                            if (v != null)
                            {
                                return(v);
                            }
                        }
                    }
                    else if (style == UITypeEditorEditStyle.Modal)
                    {
                        IDataSelectionControl modal = ts.GetUIEditorModal(context, provider, value);
                        if (modal != null)
                        {
                            if (edSvc.ShowDialog((Form)modal) == DialogResult.OK)
                            {
                                IMethodNode mn = context.Instance as IMethodNode;
                                if (mn != null)
                                {
                                    mn.SetFunction(modal.UITypeEditorSelectedValue);
                                    return(mn.GetFunctionName());
                                }
                                return(modal.UITypeEditorSelectedValue);
                            }
                        }
                    }
                }
            }
            return(value);
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CachedMethodSelector"/> class.
 /// </summary>
 /// <param name="methodSelector">
 /// The <see cref="IMethodSelector"/> responsible for selecting a get method for a given <see cref="Type"/>.
 /// </param>
 public CachedMethodSelector(IMethodSelector methodSelector)
 {
     this.methodSelector = methodSelector;
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyMapperDelegateBuilder{T}"/> class.
 /// </summary>
 /// <param name="methodSkeleton">
 /// A <see cref="IMethodSkeleton{T}"/> implementation that
 /// represents the method skeleton for which to emit the method body.
 /// </param>
 /// <param name="methodSelector">
 /// The <see cref="IMethodSelector"/> implementation that is responsible for providing a get method
 /// that targets an <see cref="IDataRecord"/> instance.
 /// </param>
 /// <param name="propertySelector">
 /// A <see cref="IPropertySelector"/> that is responsible for selecting the properties that will have its
 /// value read from an <see cref="IDataRecord"/> instance.
 /// </param>
 public PropertyMapperDelegateBuilder(IMethodSkeleton <T> methodSkeleton, IMethodSelector methodSelector, IPropertySelector propertySelector)
     : base(methodSkeleton, methodSelector)
 {
     this.propertySelector = propertySelector;
 }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CachedMethodSelector"/> class.
 /// </summary>
 /// <param name="methodSelector">
 /// The <see cref="IMethodSelector"/> responsible for selecting a get method for a given <see cref="Type"/>.
 /// </param>
 public CachedMethodSelector(IMethodSelector methodSelector)
 {
     this.methodSelector = methodSelector;
 }
コード例 #8
0
 public GenericArgumentBinder(IMethodSelector methodSelector)
 {
     _methodSelector = methodSelector;
 }
コード例 #9
0
 public FallbackToFirstCandidateMethodSelector(IMethodSelector child)
 {
     _child = child;
 }
コード例 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConstructorMapperDelegateBuilder{T}"/> class.
 /// </summary>
 /// <param name="methodSkeleton">
 /// A <see cref="IMethodSkeleton{T}"/> implementation that
 /// represents the method skeleton for which to emit the method body.
 /// </param>
 /// <param name="methodSelector">
 /// The <see cref="IMethodSelector"/> implementation that is responsible for providing a get method
 /// that targets an <see cref="IDataRecord"/> instance.
 /// </param>
 /// <param name="constructorSelector">
 /// A <see cref="IConstructorSelector"/> that is responsible for selecting the constructor to be used.
 /// </param>
 public ConstructorMapperDelegateBuilder(IMethodSkeleton <T> methodSkeleton, IMethodSelector methodSelector, IConstructorSelector constructorSelector)
     : base(methodSkeleton, methodSelector)
 {
     this.constructorSelector = constructorSelector;
 }
コード例 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MethodValidator"/> class.
 /// </summary>
 /// <param name="methodSelector">
 /// The <see cref="IMethodSelector"/> responsible for selecting the appropriate <see cref="IDataRecord"/> get method.
 /// </param>
 public MethodValidator(IMethodSelector methodSelector)
 {
     this.methodSelector = methodSelector;
 }
コード例 #12
0
 public MethodInterceptor(IMethodSelector methodSelector)
 {
     this.methodSelector = methodSelector;
 }
コード例 #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MethodValidator"/> class.
 /// </summary>
 /// <param name="methodSelector">
 /// The <see cref="IMethodSelector"/> responsible for selecting the appropriate <see cref="IDataRecord"/> get method. 
 /// </param>
 public MethodValidator(IMethodSelector methodSelector)
 {
     this.methodSelector = methodSelector;
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MapperDelegateBuilder{T}"/> class.
 /// </summary>
 /// <param name="methodSkeleton">
 /// The <see cref="IMethodSkeleton{T}"/> that represents the dynamic method to be created.
 /// </param>
 /// <param name="methodSelector">
 /// The <see cref="IMethodSelector"/> that is responsible for providing a get method
 /// used to read values from an <see cref="IDataRecord"/>.
 /// </param>
 protected MapperDelegateBuilder(IMethodSkeleton <T> methodSkeleton, IMethodSelector methodSelector)
 {
     MethodSelector      = methodSelector;
     this.methodSkeleton = methodSkeleton;
     ILGenerator         = methodSkeleton.GetILGenerator();
 }