/// <summary> /// Коррекция индексов иконок. /// </summary> public void CorrectImageIndex() { if (ImageName != "" && DBForm != null && DBForm.isDesignMode()) { ImageIndex = ImageEx.GetImageIndex(DBForm.Icons, ImageName); } }
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); } }
/// <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); } }
void componentChangeService_ComponentRemoving(object sender, ComponentEventArgs e) { // If the user is removing the control itself if (e.Component == DBForm) { IComponentChangeService componentChangeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); DBForm.DestroyVisibleComponents(); componentChangeService.OnComponentChanged(DBForm, null, null, null); } }
/// <summary> /// Обновление отображения надписи. /// </summary> public virtual void UpdateCaption() { if (DBForm != null && DBForm.isDesignMode()) { if (BaseNavBarItem != null) { BaseNavBarItem.Caption = Caption; } } }
protected override void DestroyInstance(object instance) { DBForm dbForm = FindDBForm(); if (instance is DBFormItemBase) { dbForm.DestroyControl(instance as DBFormItemBase); } base.DestroyInstance(instance); }
void form_FormClosed(object sender, FormClosedEventArgs e) { //При закрытие формы уведомить компонент о необходимости обновления данных. DBForm dbForm = FindDBForm(); if (dbForm != null) { dbForm.OnChangedItems(this, EventArgs.Empty); } }
protected override object CreateInstance(Type itemType) { DBFormItemBase dbItem = null; DBForm dbForm = FindDBForm(); if (dbForm != null) { dbItem = dbForm.CreateInstance(); } return(dbItem); }
/// <summary> /// Обновления надписей и иконок. /// </summary> public void UpdateExistCaptionAndIcon() { foreach (ViewMemberInfo info in MemberInits) { ViewMemberInfo infoExist = MemberExists.FindInfo(info); if (infoExist != null) { infoExist.Caption = info.Caption; DBForm.CreateIcon(infoExist.Item, info); } } }
/// <summary> /// Автоматическое создание элемента коллекции. /// </summary> public DBFormItemBase CreateInstance(ViewMemberInfo info = null) { DBFormItemBase item = null; if (info == null) { item = DBForm.CreateInstance(treeList: treeExist, memberExists: MemberExists); } else if (MemberExists.FindInfo(info) == null) { item = DBForm.CreateInstance(info, treeExist, MemberExists); } return(item); }
/// <summary> /// Обновления дерева уже созданных записей. /// </summary> public void UpdateExistData() { MemberExists.Clear(); foreach (DBFormItemBase item in DBForm.Items) { DBForm.PrintExistData(treeExist, item, MemberExists); } treeExist.ExpandAll(); UpdateExistButtons(); DBForm.Items.CorrectImageIndex(); }
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 override void InitializeNewComponent(IDictionary defaultValues) { object form = defaultValues["Parent"]; if (form != null && (TypeEx.IsSubclassOf(form.GetType(), typeof(Form)) || form.GetType() == typeof(Form))) { base.InitializeNewComponent(defaultValues); DBForm.InitializeVisibleComponents((Form)form); DBForm.OwnerForm = form as Form; } else { XtraMessageBox.Show("Данный объект не типа Form.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); DBForm.DestroyItself(); } }
public void OnDesigner() { DBForm.ShowDesigner(); }
public DBFormDesignerVerbCollections(DBForm dbForm) { DBForm = dbForm; Add(new DesignerVerb("Run Designer", OnDesigner)); }
private void DBFormDesignerForm_FormClosing(object sender, FormClosingEventArgs e) { DBForm.CountOpenDesigner++; DBForm.RefreshDesignCode(); }