Exemplo n.º 1
0
        //public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
        //{
        //    if (destinationType == typeof(string))
        //    {
        //        return true;
        //    }
        //    return base.CanConvertTo(context, destinationType);
        //}

        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                if (context.Instance is RadarSeries)
                {
                    RadarSeries control = null;
                    control = context.Instance as RadarSeries;
                    return(control.RadarProperties.CustomProperties);
                }
            }
            return(base.ConvertTo(context, culture, value, destinationType));
        }
Exemplo n.º 2
0
            public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
            {
                IWindowsFormsEditorService editorService = null;

                if (null != context && null != context.Instance)
                {
                    RadarSeries pcc = context.Instance as RadarSeries;
                    if (null != pcc && null != pcc.SourceField)
                    {
                        editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                        if (editorService != null)
                        {
                            FieldTreeViewData   sfAll = (PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.GetCurrentReportDataDefine()) as FieldTreeViewData;
                            RelationFieldChoose rfc   = new RelationFieldChoose(editorService);

                            rfc.strRField = pcc.BindingField;
                            List <PmsField> lp = new List <PmsField>();

                            List <SourceField> lpdb = pcc.SourceField.GetSubSourceField(sfAll);
                            foreach (SourceField pdb in lpdb)
                            {
                                try
                                {
                                    if (!string.IsNullOrEmpty(pdb.DataType))
                                    {
                                        string typ = pdb.DataType.ToUpper();
                                        if (typ.Equals("INT", StringComparison.InvariantCultureIgnoreCase) ||
                                            typ.Equals("FLOAT", StringComparison.InvariantCultureIgnoreCase) ||
                                            typ.Equals("REAL", StringComparison.InvariantCultureIgnoreCase) ||
                                            typ.Equals("INT32", StringComparison.InvariantCultureIgnoreCase) ||
                                            typ.Equals("INT16", StringComparison.InvariantCultureIgnoreCase) ||
                                            typ.Equals("INT64", StringComparison.InvariantCultureIgnoreCase) ||
                                            typ.Equals("SYSTEM.SINGLE", StringComparison.InvariantCultureIgnoreCase) ||
                                            typ.Equals("SYSTEM.DOUBLE", StringComparison.InvariantCultureIgnoreCase) ||
                                            typ.Equals("SYSTEM.INT32", StringComparison.InvariantCultureIgnoreCase) ||
                                            typ.Equals("SYSTEM.DECIMAL", StringComparison.InvariantCultureIgnoreCase))
                                        {
                                            if (pcc.seriesDataForAppearance != null && !pcc.seriesDataForAppearance.Contains(pdb.RecordField))
                                            {
                                                PmsField pf = new PmsField();
                                                pf.fieldName        = pdb.RecordField;
                                                pf.fieldDescription = pdb.Name;
                                                lp.Add(pf);
                                            }
                                        }
                                    }
                                }
                                catch
                                {
                                }
                            }
                            rfc.pmsFieldList = lp;
                            editorService.DropDownControl(rfc);
                            if (!string.IsNullOrEmpty(rfc.strRField))
                            {
                                value = rfc.strRField;
                            }
                            return(value);
                        }
                    }
                }
                return(base.EditValue(context, provider, value));
            }