Exemplo n.º 1
0
        //public IDynamicControl Make(PropertyItem define)
        //{
        //    return null;
        //}
        public CustomProperty Make(PropertyItem define)
        {
            String defaultValue = "";
            try
            {
                defaultValue = define[_XMLTag.g_AttributionVariable];
            }
            catch (Exception ex)
            {
            }

            CustomProperty property = new CustomProperty(define.Name, defaultValue, false, CustomPropertysManager.Instance.Category, define.Caption, true);
            property.Name = define.Name;
            String strValueDomain = "";
            if (define.ContainsKey(CustomPropertysManager.Instance.ValueDomain))
            {
                strValueDomain = define[CustomPropertysManager.Instance.ValueDomain];
            }
            property.Choices = new CustomChoices(strValueDomain.Split(';'), false);
            return property;
        }
Exemplo n.º 2
0
        private void FillGridsPropertys()
        {
            try
            {
                this.SuspendLayout();
                this._gridWnd.ShowCustomProperties = true;
                this._gridWnd.Item.Clear();

                CustomPropertysManager manager  = CustomPropertysManager.Instance;
                ICustomPropertyMaker   maker    = null;
                CustomProperty         property = null;

                foreach (PropertyItem item in _propertys)
                {
                    //property
                    property = manager.Make(item);

                    if (null != property)
                    {
                        this._gridWnd.Item.Add(property);
                    }

                    property = null;
                }

                this._gridWnd.ResumeLayout(false);
                this._gridWnd.PerformLayout();
                this.ResumeLayout(false);
                this.PerformLayout();
                this._gridWnd.Refresh();
                this.Refresh();
            }
            catch (Exception ex)
            {
                Toolkit.DEBUG_TRACE("Monkey.Processing.UI.GeneralPropertyGridControl.FillGridsPropertys Exception:" + ex.Message + "\n");
                return;
            }
        }
        /// <summary>
        /// 根据工厂类型查找工厂
        /// </summary>
        /// <param name="type">工厂要创建的控件类型</param>
        /// <returns>找到返回,否则返回null</returns>
        /// <remarks></remarks>
//        public ICustomPropertyMaker Find(String type)
//        //public ICustomPropertyMaker Find(PropertyItem define)
//        {
//            ICustomPropertyMaker factory = null;
//            for (Int32 i = 0; i < _factorys.Count; ++i)
//            {

////                factory = _factorys.elementAt(i);
//                factory = _factorys[i];

//                if (null != factory)
//                {
//                    if (String.Compare(factory.Type, type, true) == 0)
//                    {
//                        return factory;
//                    }
//                }
//            }

//            return null;
//        }

        //public IDynamicControl Make(PropertyItem define)
        //{
        //    ICustomPropertyMaker maker = Find(define.Type);
        //    if (null == maker)
        //    {
        //        return null;
        //    }

        //    return maker.Make(define);
        //}

        public CustomProperty Make(PropertyItem define)
        {
            lock (this)
            {
                CustomProperty cp = null;
                foreach (ICustomPropertysFactory factory in _factorys)
                {
                    cp = factory.Make(define);
                    if (null != cp)
                    {
                        return(cp);
                    }
                }
                return(null);
                //ICustomPropertyMaker maker = Find(define.Type);
                //if (null == maker)
                //{
                //    return null;
                //}

                //return maker.Make(define);
            }
        }
Exemplo n.º 4
0
        //public IDynamicControl Make(PropertyItem define)
        //{
        //    return null;

        //}

        public CustomProperty Make(PropertyItem define)
        {
            String defaultValue = "";

            try
            {
                defaultValue = define[_XMLTag.g_AttributionVariable];
            }
            catch (Exception ex)
            {
            }

            CustomProperty property = new CustomProperty(define.Name, defaultValue, false, CustomPropertysManager.Instance.Category, define.Caption, true);

            property.Name = define.Name;
            String strValueDomain = "";

            if (define.ContainsKey(CustomPropertysManager.Instance.ValueDomain))
            {
                strValueDomain = define[CustomPropertysManager.Instance.ValueDomain];
            }
            property.Choices = new CustomChoices(strValueDomain.Split(';'), false);
            return(property);
        }
Exemplo n.º 5
0
        public CustomProperty Make(PropertyItem define)
        {
            //String defaultValue = define["default"];
            //if (String.IsNullOrEmpty(defaultValue))
            //{
            //    defaultValue = "";
            //}

            Int32 size = 1;

            if (define.ContainsKey(_XMLTag.g_AttributionMaxlen))
            {
                String maxLen = define[_XMLTag.g_AttributionMaxlen];
                if (!String.IsNullOrEmpty(maxLen))
                {
                    size = Int32.Parse(maxLen);
                }
            }

            String itemType = "";

            if (define.ContainsKey(_XMLTag.g_AttributionItemType))
            {
                itemType = define[_XMLTag.g_AttributionItemType];
            }
            else if (define.ContainsKey(_XMLTag.g_AttributionType))
            {
                itemType = define[_XMLTag.g_AttributionType];
                String[] strs = itemType.Split('.');
                if (2 == strs.Length)
                {
                    itemType = strs[1];
                }
            }

            String defaultValue = "";

            if (define.ContainsKey(_XMLTag.g_AttributionVariable))
            {
                defaultValue = define[_XMLTag.g_AttributionVariable];
            }

            TypeConverter  typeConverter = null;
            CustomProperty property      = null;

            if (String.IsNullOrEmpty(itemType))
            {
                //String[] defaultValue = new String[4];
                //defaultValue[0] = define["default"];
                property = new CustomProperty(define.Name, Toolkit.ToStringArray(defaultValue), false, CustomPropertysManager.Instance.Category, define.Caption, true);
                property.CustomTypeConverter = new ArrayConverter();
            }
            else
            {
                switch (itemType)
                {
                case "Int32":
                {
                    Int32[] intArray = new Int32[size];
                    Toolkit.CopyArray(intArray, Toolkit.ToInt32Array(defaultValue));
                    property = new CustomProperty(define.Name, intArray, false, CustomPropertysManager.Instance.Category, define.Caption, true);
                    property.CustomTypeConverter = new ArrayConverter();
                }
                break;

                case "String":
                {
                    String[] stringArray = new String[size];
                    Toolkit.CopyArray(stringArray, Toolkit.ToStringArray(defaultValue));
                    property = new CustomProperty(define.Name, stringArray, false, CustomPropertysManager.Instance.Category, define.Caption, true);
                    property.CustomTypeConverter = new ArrayConverter();
                    //StringArrayConverter();
                }
                break;

                case "Single":
                {
                    Single[] singleArray = new Single[size];
                    Toolkit.CopyArray(singleArray, Toolkit.ToSingleArray(defaultValue));
                    property = new CustomProperty(define.Name, singleArray, false, CustomPropertysManager.Instance.Category, define.Caption, true);
                    property.CustomTypeConverter = new ArrayConverter();
                }
                break;

                default:
                {
                    String[] stringArray = new String[size];
                    Toolkit.CopyArray(stringArray, Toolkit.ToStringArray(defaultValue));
                    property = new CustomProperty(define.Name, stringArray, false, CustomPropertysManager.Instance.Category, define.Caption, true);
                    property.CustomTypeConverter = new ArrayConverter();
                }
                break;
                }
            }


            //String[] defaultValue = new String[4];
            //defaultValue[0] = define["default"]; ;

            //CustomProperty property = new CustomProperty(define.Name, defaultValue, false, CustomPropertysManager.Instance.Category, define.Caption, true);
            property.Name = define.Name;
//            property.CustomTypeConverter = typeConverter;
            return(property);
        }
Exemplo n.º 6
0
 public virtual int Add(CustomProperty value)
 {
     return(base.List.Add(value));
 }
 public virtual int Add(CustomProperty value)
 {
     return base.List.Add(value);
 }
Exemplo n.º 8
0
        [RefreshProperties(RefreshProperties.All)] public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            if (context == null || provider == null || context.Instance == null)
            {
                return(base.EditValue(provider, value));
            }

            oEditorService = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (oEditorService != null)
            {
                // Get the Back reference to the Custom FromId
                CustomProperty.CustomPropertyDescriptor oDescriptor = (CustomProperty.CustomPropertyDescriptor)context.PropertyDescriptor;
                CustomProperty cp = (CustomProperty)oDescriptor.CustomProperty;

                // Declare attributes
                UIListboxDatasource    datasource;
                UIListboxValueMember   valuemember;
                UIListboxDisplayMember displaymember;

                // Get attributes
                datasource    = (UIListboxDatasource)context.PropertyDescriptor.Attributes[typeof(UIListboxDatasource)];
                valuemember   = (UIListboxValueMember)context.PropertyDescriptor.Attributes[typeof(UIListboxValueMember)];
                displaymember = (UIListboxDisplayMember)context.PropertyDescriptor.Attributes[typeof(UIListboxDisplayMember)];

                oList.BorderStyle    = BorderStyle.None;
                oList.IntegralHeight = true;

                if (datasource != null)
                {
                    oList.DataSource = datasource.Value;
                }

                if (displaymember != null)
                {
                    oList.DisplayMember = displaymember.Value;
                }

                if (valuemember != null)
                {
                    oList.ValueMember = valuemember.Value;
                }

                if (value != null)
                {
                    if (value.GetType().Name == "String")
                    {
                        oList.Text = (string)value;
                    }
                    else
                    {
                        oList.SelectedItem = value;
                    }
                }


                oList.SelectedIndexChanged += new System.EventHandler(this.SelectedItem);

                oEditorService.DropDownControl(oList);
                if (oList.SelectedIndices.Count == 1)
                {
                    cp.SelectedItem  = oList.SelectedItem;
                    cp.SelectedValue = oSelectedValue;
                    value            = oList.Text;
                }
                oEditorService.CloseDropDown();
            }
            else
            {
                return(base.EditValue(provider, value));
            }

            return(value);
        }
Exemplo n.º 9
0
        public CustomProperty Make(PropertyItem define)
        {
            //String defaultValue = define["default"];
            //if (String.IsNullOrEmpty(defaultValue))
            //{
            //    defaultValue = "";
            //}

            Int32 size = 1;
            if (define.ContainsKey(_XMLTag.g_AttributionMaxlen))
            {
                String maxLen = define[_XMLTag.g_AttributionMaxlen];
                if (!String.IsNullOrEmpty(maxLen))
                {
                    size = Int32.Parse(maxLen);
                }
            }

            String itemType = "";
            if (define.ContainsKey(_XMLTag.g_AttributionItemType))
            {
                itemType = define[_XMLTag.g_AttributionItemType];
            }
            else if (define.ContainsKey(_XMLTag.g_AttributionType))
            {
                itemType = define[_XMLTag.g_AttributionType];
                String[] strs = itemType.Split('.');
                if (2 == strs.Length)
                {
                    itemType = strs[1];
                }
            }

            String defaultValue = "";
            if (define.ContainsKey(_XMLTag.g_AttributionVariable))
            {
                defaultValue = define[_XMLTag.g_AttributionVariable];
            }

            TypeConverter typeConverter = null;
            CustomProperty property = null;
            if (String.IsNullOrEmpty(itemType))
            {
                //String[] defaultValue = new String[4];
                //defaultValue[0] = define["default"];
                property = new CustomProperty(define.Name, Toolkit.ToStringArray(defaultValue), false, CustomPropertysManager.Instance.Category, define.Caption, true);
                property.CustomTypeConverter = new ArrayConverter();
            }
            else
            {
                switch (itemType)
                {
                    case "Int32":
                        {

                            Int32[] intArray = new Int32[size];
                            Toolkit.CopyArray(intArray, Toolkit.ToInt32Array(defaultValue));
                            property = new CustomProperty(define.Name, intArray, false, CustomPropertysManager.Instance.Category, define.Caption, true);
                            property.CustomTypeConverter = new ArrayConverter();
                        }
                        break;
                    case "String":
                        {
                            String[] stringArray = new String[size];
                            Toolkit.CopyArray(stringArray, Toolkit.ToStringArray(defaultValue));
                            property = new CustomProperty(define.Name, stringArray, false, CustomPropertysManager.Instance.Category, define.Caption, true);
                            property.CustomTypeConverter = new ArrayConverter();
                            //StringArrayConverter();
                        }
                        break;
                    case "Single":
                        {
                            Single[] singleArray = new Single[size];
                            Toolkit.CopyArray(singleArray, Toolkit.ToSingleArray(defaultValue));
                            property = new CustomProperty(define.Name, singleArray, false, CustomPropertysManager.Instance.Category, define.Caption, true);
                            property.CustomTypeConverter = new ArrayConverter();
                        }
                        break;
                    default:
                        {
                            String[] stringArray = new String[size];
                            Toolkit.CopyArray(stringArray, Toolkit.ToStringArray(defaultValue));
                            property = new CustomProperty(define.Name, stringArray, false, CustomPropertysManager.Instance.Category, define.Caption, true);
                            property.CustomTypeConverter = new ArrayConverter();
                        }
                        break;
                }
            }

            //String[] defaultValue = new String[4];
            //defaultValue[0] = define["default"]; ;

            //CustomProperty property = new CustomProperty(define.Name, defaultValue, false, CustomPropertysManager.Instance.Category, define.Caption, true);
            property.Name = define.Name;
            //            property.CustomTypeConverter = typeConverter;
            return property;
        }
Exemplo n.º 10
0
        //public PropertyItem Define
        //{
        //    set
        //    {
        //        _define = value;
        //    }
        //}

        public CustomProperty Make(PropertyItem define)
        {
            try
            {
                //String defaultValue = define["default"];
                //if (String.IsNullOrEmpty(defaultValue))
                //{
                //    defaultValue = "";
                //}

                //String [] defaultValue = new String[4];

                String defaultValue = String.Empty;
                //if (define.ContainsKey(_XMLTag.g_AttributionDefault))
                //{
                //    defaultValue = define[_XMLTag.g_AttributionDefault];
                //}
                if (define.ContainsKey(_XMLTag.g_AttributionVariable))
                {
                    defaultValue = define[_XMLTag.g_AttributionVariable];
                }

                String caption = define.Caption;
                if (String.IsNullOrEmpty(caption))
                {
                    caption = define.Name;
                }


                CustomProperty property = new CustomProperty(define.Name, defaultValue, false, CustomPropertysManager.Instance.Category, caption, true);

                property.Name = define.Name;
                //property.CustomTypeConverter = new StringConverter();

                //property.CustomTypeConverter = new System.Web.UI.WebControls.StringArrayConverter();
                //property.CustomTypeConverter = new ArrayConverter();
                return(property);

                String itemType = define["ItemType"];
                //if (String.IsNullOrEmpty(defaultValue))
                //{
                //    property.CustomTypeConverter = new StringConverter();
                //}
                //else
                //{
                //    switch (itemType)
                //    {
                //        case "Int32":
                //            {
                //                //property.CustomTypeConverter = new Int32Converter();
                //                property.CustomTypeConverter = new TypeConverterArray();
                //            }
                //            break;
                //        case "String":
                //            {
                //                property.CustomTypeConverter = new StringConverter();
                //                //StringArrayConverter();
                //            }
                //            break;
                //        case "Single":
                //            {
                //                property.CustomTypeConverter = new SingleConverter();
                //            }
                //            break;
                //        default:
                //            {
                //                property.CustomTypeConverter = new StringConverter();
                //            }
                //            break;
                //    }
                //}



                //property.CustomTypeConverter = new Int32Converter();
                //property.CustomEditor = new

                return(property);
            }
            catch (Exception ex)
            {
                Toolkit.DEBUG_TRACE("Monkey.Processing.UI.GeneralPropertyGridControl.FillGridsPropertyGroups Exception:" + ex.Message + "\n");
                return(null);
            }
        }
Exemplo n.º 11
0
            public CustomPropertyDescriptor(CustomProperty myProperty, Attribute[] attrs)
                : base(myProperty.Name, attrs)
            {
                if (myProperty == null)
                {
                    oCustomProperty = null;
                }
                else
                {

                    oCustomProperty = myProperty;
                }
            }
Exemplo n.º 12
0
        //public PropertyItem Define
        //{
        //    set
        //    {
        //        _define = value;
        //    }
        //}
        public CustomProperty Make(PropertyItem define)
        {
            try
            {
                //String defaultValue = define["default"];
                //if (String.IsNullOrEmpty(defaultValue))
                //{
                //    defaultValue = "";
                //}

                //String [] defaultValue = new String[4];

                String defaultValue = String.Empty;
                //if (define.ContainsKey(_XMLTag.g_AttributionDefault))
                //{
                //    defaultValue = define[_XMLTag.g_AttributionDefault];
                //}
                if (define.ContainsKey(_XMLTag.g_AttributionVariable))
                {
                    defaultValue = define[_XMLTag.g_AttributionVariable];
                }

                String caption = define.Caption;
                if (String.IsNullOrEmpty(caption))
                {
                    caption = define.Name;
                }

                CustomProperty property = new CustomProperty(define.Name, defaultValue, false, CustomPropertysManager.Instance.Category, caption, true);

                property.Name = define.Name;
                //property.CustomTypeConverter = new StringConverter();

                //property.CustomTypeConverter = new System.Web.UI.WebControls.StringArrayConverter();
                //property.CustomTypeConverter = new ArrayConverter();
                return property;

                String itemType = define["ItemType"];
                //if (String.IsNullOrEmpty(defaultValue))
                //{
                //    property.CustomTypeConverter = new StringConverter();
                //}
                //else
                //{
                //    switch (itemType)
                //    {
                //        case "Int32":
                //            {
                //                //property.CustomTypeConverter = new Int32Converter();
                //                property.CustomTypeConverter = new TypeConverterArray();
                //            }
                //            break;
                //        case "String":
                //            {
                //                property.CustomTypeConverter = new StringConverter();
                //                //StringArrayConverter();
                //            }
                //            break;
                //        case "Single":
                //            {
                //                property.CustomTypeConverter = new SingleConverter();
                //            }
                //            break;
                //        default:
                //            {
                //                property.CustomTypeConverter = new StringConverter();
                //            }
                //            break;
                //    }
                //}

                //property.CustomTypeConverter = new Int32Converter();
                //property.CustomEditor = new

                return property;
            }
            catch (Exception ex)
            {
                Toolkit.DEBUG_TRACE("Monkey.Processing.UI.GeneralPropertyGridControl.FillGridsPropertyGroups Exception:" + ex.Message + "\n");
                return null;
            }
        }