/// <summary>
 /// Коррекция индексов иконок.
 /// </summary>
 public void CorrectImageIndex()
 {
     if (ImageName != "" && DBForm != null && DBForm.isDesignMode())
     {
         ImageIndex = ImageEx.GetImageIndex(DBForm.Icons, ImageName);
     }
 }
 /// <summary>
 /// Коррекция индексов иконок.
 /// </summary>
 public void CorrectImageIndex()
 {
     if (ImageName != "" && DBInterface != null && DBInterface.IsDesignModeEx)
     {
         ImageIndex = ImageEx.GetImageIndex(DBInterface.Icons, ImageName);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Создание списка возможных типов таблицы.
        /// </summary>
        public void GenerateInitTables()
        {
            if (DBForm.TypeDiscoveryService != null)
            {
                ICollection types = DBForm.TypeDiscoveryService.GetTypes(typeof(DBViewBase), false);
                foreach (Type actionType in types)
                {
                    if (actionType != typeof(DBViewBase))
                    {
                        ViewMemberInfo info = new ViewMemberInfo();
                        info.ViewType = actionType;
                        info.Caption  = DBAttribute.GetCaption(actionType);

                        string name = DBAttribute.GetIconFile(info.ViewType);

                        string dir = DBForm.GetImageFullName(name);
                        if (dir != "" && File.Exists(dir) && !ImageEx.IsExist(imgInit, name))
                        {
                            imgInit.AddImage(Image.FromFile(dir), name);
                        }

                        info.ImageIndex = ImageEx.GetImageIndex(imgInit, name);
                        info.ImageName  = name;
                        if (MemberExists.FindInfo(info) != null)
                        {
                            info.IsUsed = true;
                        }

                        MemberInits.Add(info);
                    }
                }
                lblTotalCount.Caption = string.Format("Всего: {0}", types.Count);
            }
        }
        /// <summary>
        /// Анализ PropertyInfoEx объекта и добавление полученных данных в объект TableMemberInfo.
        /// </summary>
        public TableMemberInfo AnalisProperty(PropertyInfoEx propertyInfo, TableMemberInfo tableInfo, ref int recordCount)
        {
            TableMemberInfo result = new TableMemberInfo();

            result.FieldName    = propertyInfo.PropertyInfo.Name;
            result.Caption      = PropertyInfoEx.GetDisplayNameAttribute(propertyInfo.PropertyInfo);
            result.PropertyType = propertyInfo.PropertyInfo.PropertyType;
            if (propertyInfo.IsXPCollection)
            {
                result.PropertyTypeCollection = propertyInfo.PropertyInfoCollection.PropertyType;
            }
            result.IsXPBaseObject = propertyInfo.IsXPBaseObject;
            result.IsXPCollection = propertyInfo.IsXPCollection;

            if (result.IsXPBaseObject || result.IsXPCollection)
            {
                string name = "";
                if (result.IsXPBaseObject)
                {
                    name = DBAttribute.GetIconFile(result.PropertyType);
                }
                if (result.IsXPCollection)
                {
                    name = DBAttribute.GetIconFile(result.PropertyTypeCollection);
                }

                string dir = DBInterface.GetImageFullName(name);
                if (dir != "" && File.Exists(dir) && !ImageEx.IsExist(imgInit, name))
                {
                    imgInit.AddImage(Image.FromFile(dir), name);
                }

                result.ImageIndex = ImageEx.GetImageIndex(imgInit, name);
                result.ImageName  = name;
            }

            if (tableInfo != null)
            {
                tableInfo.Add(result);
            }

            if (MemberExists.FindInfo(result) != null)
            {
                result.IsUsed = true;
            }

            // Ограничение по количеству записей
            recordCount++;
            if (recordCount >= RecordCountMax)
            {
                return(null);
            }
            else
            {
                return(result);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Создание иконки записи.
        /// </summary>
        public void CreateIcon(DBFormItemBase item, ViewMemberInfo info)
        {
            string imageName = GetImageFullName(info.ImageName);
            if (!ImageEx.IsExist(Icons, info.ImageName) && File.Exists(imageName))
            {
                Image image = Image.FromFile(imageName);
                Icons.Images.Add(image, info.ImageName);
            }

            item.ImageIndex = ImageEx.GetImageIndex(Icons, info.ImageName);
        }