Пример #1
0
        /// <summary>
        /// Удаление компонента и других связанных с ним компонентов.
        /// </summary>
        public void DestroyVisibleComponents()
        {
            IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));

            DestroyItems();

            HostComponent.DestroyComponent(host, BaseLayoutControl);
            HostComponent.DestroyComponent(host, BaseLayoutGroup);
            HostComponent.DestroyComponent(host, FilterLayoutItem);
            HostComponent.DestroyComponent(host, BarLayoutItem);
            HostComponent.DestroyComponent(host, FilterClearLayoutItem);

            HostComponent.DestroyComponent(host, FilterTextEdit);
            HostComponent.DestroyComponent(host, FilterClearButton);

            HostComponent.DestroyComponent(host, BaseNavBarControl);
            HostComponent.DestroyComponent(host, BaseNavBarGroup);

            HostComponent.DestroyComponent(host, Icons);

            if (OwnerForm != null)
            {
                OwnerForm.IsMdiContainer = false;
                OwnerForm.Controls.Remove(BaseDockPanel);

                HostComponent.DestroyComponent(host, BaseDocumentManager);
                HostComponent.DestroyComponent(host, BaseTabbedView);
                HostComponent.DestroyComponent(host, BaseDockManager);
            }
        }
        public override void InitializeNewComponent(IDictionary defaultValues)
        {
            IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));

            if (HostComponent.FindSimilarClass(host, typeof(DBConnection), dbConnection))
            {
                XtraMessageBox.Show("Объект типа DBClass уже содержится на форме",
                                    "Ошибка",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error,
                                    MessageBoxDefaultButton.Button1);

                dbConnection.DestroyItself();
            }
            else
            {
                object form = defaultValues["Parent"];
                if (form != null && (TypeEx.IsSubclassOf(form.GetType(), typeof(Form)) || form.GetType() == typeof(Form)))
                {
                    base.InitializeNewComponent(defaultValues);
                    dbConnection.OwnerForm = form as Form;
                }
                else
                {
                    XtraMessageBox.Show("Данный объект не типа Form.",
                                        "Ошибка",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Error,
                                        MessageBoxDefaultButton.Button1);

                    dbConnection.DestroyItself();
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Удание элемента коллекции.
        /// </summary>
        public void DestroyControl(DBFormItemBase item)
        {
            IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));
            DesignerTransaction transaction = host.CreateTransaction("DeleteControl");

            HostComponent.DestroyComponent(host, item.BaseNavBarItem);

            transaction.Commit();
        }
Пример #4
0
        /// <summary>
        /// Удаление компонента и других связанных с ним компонентов.
        /// </summary>
        public void DestroyVisibleComponents()
        {
            IDesignerHost       host        = (IDesignerHost)GetService(typeof(IDesignerHost));
            DesignerTransaction transaction = host.CreateTransaction("DestroyVisibleComponent");

            DBInterface.DestroyVisibleComponents();

            HostComponent.DestroyComponent(host, DBInterface);

            transaction.Commit();
        }
Пример #5
0
        /// <summary>
        /// Инициализация компонента и создание группы других компонентов.
        /// </summary>
        public void InitializeVisibleComponents()
        {
            IDesignerHost       host        = (IDesignerHost)GetService(typeof(IDesignerHost));
            DesignerTransaction transaction = host.CreateTransaction("InitializeDBInterfaceView");

            // Create compnonents
            DBInterface = (DBInterface)HostComponent.CreateComponent(host, typeof(DBInterface), "_dbInterface");

            DBInterface.Dock = DockStyle.Fill;
            DBInterface.InitializeVisibleComponents();

            Controls.Add(DBInterface);

            transaction.Commit();
        }
Пример #6
0
        /// <summary>
        /// Создание всех элементов для данного типа поля таблицы БД.
        /// </summary>
        public void CreateControl(DBFormItemBase item, string name)
        {
            IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));
            DesignerTransaction transaction = host.CreateTransaction("AddControl");

            item.DBForm = this;
            item.BaseNavBarItem = (NavBarItem)HostComponent.CreateComponent(host, typeof(NavBarItem), string.Format("{0}NavBarItem", name));
            item.BaseNavBarItem.AppearancePressed.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Bold);
            item.BaseNavBarItem.AppearancePressed.ForeColor = System.Drawing.Color.Red;
            item.BaseNavBarItem.AppearancePressed.Options.UseFont = true;
            item.BaseNavBarItem.AppearancePressed.Options.UseForeColor = true;

            BaseNavBarControl.Items.Add(item.BaseNavBarItem);
            BaseNavBarGroup.ItemLinks.Add(new NavBarItemLink(item.BaseNavBarItem));
            BaseNavBarGroup.SelectedLinkIndex = -1;
            item.UpdateAll();

            transaction.Commit();
        }
Пример #7
0
        /// <summary>
        /// Удаление самого себя.
        /// </summary>
        public void DestroyItself()
        {
            IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));

            HostComponent.DestroyComponent(host, this);
        }
Пример #8
0
 /// <summary>
 /// Создание объета связки визуальных объектов.
 /// </summary>
 public IComponent CreateComponent(Type type, string name)
 {
     IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));
     return HostComponent.CreateComponent(host, type, name);
 }
Пример #9
0
        /// <summary>
        /// Инициализация компонента и создание группы других компонентов.
        /// </summary>
        public void InitializeVisibleComponents(Form form)
        {
            OwnerForm = form;

            IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));
            DesignerTransaction transaction = host.CreateTransaction("InitializeDBForm");

            // Создание компонентов.
            BaseDockManager = (DockManager)HostComponent.CreateComponent(host, typeof(DockManager), "baseDockManager");
            BaseDockPanel = (DockPanel)HostComponent.CreateComponent(host, typeof(DockPanel), "baseDockPanel");
            BaseControlContainer = (ControlContainer)HostComponent.CreateComponent(host, typeof(ControlContainer), "baseControlContainer");

            BaseLayoutControl = (LayoutControlEx)HostComponent.CreateComponent(host, typeof(LayoutControlEx), "baseLayoutControl");
            BaseLayoutGroup = (LayoutControlGroup)HostComponent.CreateComponent(host, typeof(LayoutControlGroup), "baseLayoutGroup");
            FilterLayoutItem = (LayoutControlItem)HostComponent.CreateComponent(host, typeof(LayoutControlItem), "filterLayoutItem");
            BarLayoutItem = (LayoutControlItem)HostComponent.CreateComponent(host, typeof(LayoutControlItem), "barLayoutItem");
            FilterClearLayoutItem = (LayoutControlItem)HostComponent.CreateComponent(host, typeof(LayoutControlItem), "filterClearLayoutItem");

            FilterTextEdit = (TextEdit)HostComponent.CreateComponent(host, typeof(TextEdit), "filterTextEdit");
            FilterClearButton = (SimpleButton)HostComponent.CreateComponent(host, typeof(SimpleButton), "filterClearButton");

            BaseNavBarControl = (NavBarControl)HostComponent.CreateComponent(host, typeof(NavBarControl), "baseNavBarControl");
            BaseNavBarGroup = (NavBarGroup)HostComponent.CreateComponent(host, typeof(NavBarGroup), "baseNavBarGroup");

            BaseDocumentManager = (DocumentManager)HostComponent.CreateComponent(host, typeof(DocumentManager), "baseDocumentManager");
            BaseTabbedView = (TabbedView)HostComponent.CreateComponent(host, typeof(TabbedView), "baseTabbedView");

            Icons = (ImageCollection)HostComponent.CreateComponent(host, typeof(ImageCollection), "icons");


            ((ISupportInitialize)(BaseDockManager)).BeginInit();
            BaseDockPanel.SuspendLayout();
            BaseControlContainer.SuspendLayout();
            ((ISupportInitialize)(BaseLayoutControl)).BeginInit();
            BaseLayoutControl.SuspendLayout();
            ((ISupportInitialize)(BaseLayoutGroup)).BeginInit();
            ((ISupportInitialize)(FilterTextEdit.Properties)).BeginInit();
            ((ISupportInitialize)(FilterLayoutItem)).BeginInit();
            ((ISupportInitialize)(BaseNavBarControl)).BeginInit();
            ((ISupportInitialize)(BarLayoutItem)).BeginInit();
            ((ISupportInitialize)(FilterClearLayoutItem)).BeginInit();
            ((ISupportInitialize)(BaseDocumentManager)).BeginInit();
            ((ISupportInitialize)(BaseTabbedView)).BeginInit();
            ((ISupportInitialize)(Icons)).BeginInit();

            // 
            // BaseDockManager
            // 
            BaseDockManager.Form = OwnerForm;
            BaseDockManager.RootPanels.AddRange(new DockPanel[] {
            BaseDockPanel});
            BaseDockManager.TopZIndexControls.AddRange(new string[] {
            "DevExpress.XtraBars.BarDockControl",
            "DevExpress.XtraBars.StandaloneBarDockControl",
            "System.Windows.Forms.StatusBar",
            "DevExpress.XtraBars.Ribbon.RibbonStatusBar",
            "DevExpress.XtraBars.Ribbon.RibbonControl"});
            // 
            // BaseDockPanel
            // 
            BaseDockPanel.Controls.Add(BaseControlContainer);
            BaseDockPanel.Dock = DockingStyle.Left;
            BaseDockPanel.Location = new Point(0, 0);
            BaseDockPanel.OriginalSize = new Size(200, 200);
            BaseDockPanel.Size = new Size(200, 537);
            BaseDockPanel.Text = "Навигация";
            // 
            // BaseControlContainer
            // 
            BaseControlContainer.Controls.Add(this);
            BaseControlContainer.Location = new Point(4, 23);
            BaseControlContainer.Size = new Size(192, 510);
            BaseControlContainer.TabIndex = 0;

            // 
            // BaseLayoutControl
            // 
            BaseLayoutControl.Controls.Add(FilterClearButton);
            BaseLayoutControl.Controls.Add(BaseNavBarControl);
            BaseLayoutControl.Controls.Add(FilterTextEdit);
            BaseLayoutControl.Dock = DockStyle.Fill;
            BaseLayoutControl.Location = new Point(0, 0);
            BaseLayoutControl.Root = BaseLayoutGroup;
            BaseLayoutControl.Size = new Size(192, 510);
            BaseLayoutControl.TabIndex = 0;
            // 
            // BaseLayoutGroup
            // 
            BaseLayoutGroup.CustomizationFormText = "Формы";
            BaseLayoutGroup.EnableIndentsWithoutBorders = DefaultBoolean.True;
            BaseLayoutGroup.GroupBordersVisible = false;
            BaseLayoutGroup.Items.AddRange(new BaseLayoutItem[] {
            FilterLayoutItem,
            BarLayoutItem,
            FilterClearLayoutItem});
            BaseLayoutGroup.Location = new Point(0, 0);
            BaseLayoutGroup.Size = new Size(192, 510);
            BaseLayoutGroup.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
            BaseLayoutGroup.TextVisible = false;
            // 
            // FilterClearLayoutItem
            // 
            FilterClearLayoutItem.Control = FilterClearButton;
            FilterClearLayoutItem.CustomizationFormText = "Очистка фильтра";
            FilterClearLayoutItem.Location = new Point(0, 0);
            FilterClearLayoutItem.Size = new Size(26, 26);
            FilterClearLayoutItem.TextSize = new Size(0, 0);
            FilterClearLayoutItem.TextToControlDistance = 0;
            FilterClearLayoutItem.TextVisible = false;
            // 
            // FilterLayoutItem
            // 
            FilterLayoutItem.Control = FilterTextEdit;
            FilterLayoutItem.CustomizationFormText = "Фильтр";
            FilterLayoutItem.Location = new Point(26, 0);
            FilterLayoutItem.Size = new Size(146, 26);
            FilterLayoutItem.TextSize = new Size(0, 0);
            FilterLayoutItem.TextToControlDistance = 0;
            FilterLayoutItem.TextVisible = false;
            // 
            // BarLayoutItem
            // 
            BarLayoutItem.Control = BaseNavBarControl;
            BarLayoutItem.CustomizationFormText = "Навигация";
            BarLayoutItem.Location = new Point(0, 26);
            BarLayoutItem.Size = new Size(172, 464);
            BarLayoutItem.TextSize = new Size(0, 0);
            BarLayoutItem.TextToControlDistance = 0;
            BarLayoutItem.TextVisible = false;

            // 
            // FilterClearButton
            // 
            FilterClearButton.Image = InitIcons.Images[0];
            // 
            // BaseNavBarControl
            // 
            BaseNavBarControl.Dock = DockStyle.Fill;
            //BaseNavBarControl.AllowSelectedLink = true;
            BaseNavBarControl.LinkSelectionMode = LinkSelectionModeType.OneInControl;
            BaseNavBarControl.ActiveGroup = BaseNavBarGroup;
            BaseNavBarControl.SmallImages = Icons;
            BaseNavBarControl.Groups.AddRange(new NavBarGroup[] {
            BaseNavBarGroup});
            // 
            // BaseNavBarGroup
            // 
            BaseNavBarGroup.Caption = "Формы";
            BaseNavBarGroup.Expanded = true;
            // 
            // BaseDocumentManager
            // 
            //documentManager.BarAndDockingController = barAndDockingController;
            BaseDocumentManager.MdiParent = OwnerForm;
            //documentManager.MenuManager = barManager;
            BaseDocumentManager.View = BaseTabbedView;
            BaseDocumentManager.Images = Icons;
            BaseDocumentManager.ViewCollection.AddRange(new BaseView[] {
            BaseTabbedView});
            // 
            // tabbedView
            // 
            //tabbedView.DocumentClosing += new DocumentCancelEventHandler(tabbedView_DocumentClosing);

            // 
            // this
            // 
            Dock = DockStyle.Fill;
            Controls.Add(BaseLayoutControl);

            // 
            // OwnerForm
            // 
            OwnerForm.IsMdiContainer = true;
            OwnerForm.Controls.Add(BaseDockPanel);

            ((ISupportInitialize)(BaseDockManager)).EndInit();
            BaseDockPanel.ResumeLayout(false);
            BaseControlContainer.ResumeLayout(false);
            ((ISupportInitialize)(BaseLayoutControl)).EndInit();
            BaseLayoutControl.ResumeLayout(false);
            ((ISupportInitialize)(BaseLayoutGroup)).EndInit();
            ((ISupportInitialize)(FilterTextEdit.Properties)).EndInit();
            ((ISupportInitialize)(FilterLayoutItem)).EndInit();
            ((ISupportInitialize)(BaseNavBarControl)).EndInit();
            ((ISupportInitialize)(BarLayoutItem)).EndInit();
            ((ISupportInitialize)(FilterClearLayoutItem)).EndInit();
            ((ISupportInitialize)(BaseDocumentManager)).EndInit();
            ((ISupportInitialize)(BaseTabbedView)).EndInit();
            ((ISupportInitialize)(Icons)).EndInit();

            transaction.Commit();
        }