private void btnDelete_Click(object sender, EventArgs e) { ViewMemberInfos deletings = new ViewMemberInfos(); foreach (TreeListNode node in treeExist.Selection) { ViewMemberInfo info = treeExist.GetDataRecordByNode(node) as ViewMemberInfo; if (info != null && info.Item != null) { DBForm.DestroyInstance(info.Item); UnuseInitTable(info); //EraseExistDate(vwInfo); deletings.Add(info); } } // Удаление записей foreach (ViewMemberInfo infoInter in deletings) { MemberExists.Remove(infoInter); } }
public DBFormDesignerForm(DBForm dbForm) { InitializeComponent(); DBForm = dbForm; MemberInits = new ViewMemberInfos(); MemberExists = new ViewMemberInfos(); treeExist.StateImageList = DBForm.Icons; UpdateExistData(); GenerateInitTables(); treeInit.DataSource = MemberInits; treeExist.DataSource = MemberExists; TypeTables = new XPTables(); TypeTables.FillTable(DBForm.TypeDiscoveryService, typeof(DBViewBase)); gluiViewType2.DataSource = TypeTables; }
public ViewMemberInfo() { _Items = new ViewMemberInfos(); _HashCode = GetHashCode(); _IsUsed = false; }
/// <summary> /// Создание элемента коллекции. /// </summary> public DBFormItemBase CreateInstance(ViewMemberInfo info = null, TreeList treeList = null, ViewMemberInfos memberExists = null) { DBFormItemBase item = null; string name = "BaseView"; if (info != null) { name = info.ViewTypeName; if (TypeEx.IsSubclassOf(info.ViewType, typeof(DBViewInterface))) item = CreateComponent(typeof(DBFormItemView), name) as DBFormItemBase; else item = CreateComponent(typeof(DBFormItemBase), name) as DBFormItemBase; info.IsUsed = true; item.ViewType = info.ViewType; item.Caption = info.Caption; if (item.Caption == "") item.Caption = name; item.ImageName = info.ImageName; } else item = CreateComponent(typeof(DBFormItemBase), name) as DBFormItemBase; Items.Add(item); CreateControl(item, name); if (info != null) CreateIcon(item, info); if (treeList != null && memberExists != null) PrintExistData(treeList, item, memberExists); return item; }
/// <summary> /// Создание записи для уже созданных полей таблицы /// </summary> public static ViewMemberInfo PrintExistData(TreeList treeList, DBFormItemBase item, ViewMemberInfos infos) { ViewMemberInfo info = new ViewMemberInfo() { ViewType = item.ViewType, Caption = item.Caption, ImageIndex = item.ImageIndex, ImageName = item.ImageName, Item = item }; infos.Add(info); TreeListNode node = FindNode(treeList, info); if (node != null) { treeList.FocusedNode = node; treeList.Selection.Clear(); treeList.Selection.Add(treeList.FocusedNode); } return info; }