示例#1
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>
        /// Обновления надписей и иконок.
        /// </summary>
        public void UpdateExistCaptionAndIcon()
        {
            foreach (TableMemberInfo info in MemberInits)
            {
                TableMemberInfo infoExist = MemberExists.FindInfo(info);
                if (infoExist != null)
                {
                    infoExist.Caption = info.Caption;
                    DBInterface.CreateIcon(infoExist.Item, info);

                    if (info.Items.Count > 0)
                    {
                        UpdateExistCaptionAndIcon(info.Items, 1);
                    }
                }
            }

            DBInterface.TableCaption = DBAttribute.GetCaption(DBInterface.TableType);
        }