Example #1
0
        private void buttonClick3(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            OpenPanelRequest panelRequest = new OpenPanelRequest {
                Vci = Info.getVisualControlInfoByGuid(Guid.Parse(supp.TestControl.GUID))
            };
            OpenPanelRequestEvent openPanelEvent = new OpenPanelRequestEvent(this, panelRequest);

            EventProxy.fireEvent(openPanelEvent);
        }
Example #2
0
        private void HandleOpenPanelRequestEvent(object sender, OpenPanelRequestEvent e)
        {
            OpenPanelRequest ee = (OpenPanelRequest)e.Data;

            core.controls.VisualControlInfo vci = ee.Vci;

            // handle eventual multi opening
            if (!vci.AllowMulti)
            {
                BaseDocument existingDocument = _managerSupport.getDocumentByVCI(vci);
                if (existingDocument != null)
                {
                    documentManager.View.Controller.Activate(existingDocument);
                    VisualControl existingVisualControl = (VisualControl)existingDocument.Control;
                    if ((existingVisualControl != null) && (ee.DataObject != null))
                    {
                        existingVisualControl.Start(core.controls.VisualControlStartingKind.ActivateOpened, ee.DataObject);
                    }
                    return;
                }
            }

            VisualControl control = (VisualControl)vci.createInstance();

            if (control != null)
            {
                if (vci.DockStyle == core.controls.ControlDockStyle.PLGT_document)
                {
                    documentManager.BeginUpdate();
                    BaseDocument document = documentManager.View.AddDocument(control);
                    document.Caption     = control.VisualControlInfo.Name;
                    document.ControlName = control.VisualControlInfo.Name;
                    documentManager.EndUpdate();
                    documentManager.View.Controller.Activate(document);
                }
                else if (vci.DockStyle == core.controls.ControlDockStyle.PLGT_status)
                {
                    DockPanel pb = new DockPanel();

                    if (dockManager.Panels.Count == 0)
                    {
                        pb = dockManager.AddPanel(DockingStyle.Bottom);
                    }
                    else
                    if (dockManager.Panels.Count == 1)
                    {
                        pb = dockManager.AddPanel(DockingStyle.Bottom);
                        DockPanel panelX = dockManager.Panels[0] as DockPanel;
                        pb.DockAsTab(panelX);
                    }
                    else
                    if (dockManager.Panels.Count > 1)
                    {
                        pb = dockManager.AddPanel(DockingStyle.Bottom);
                        DockPanel container = dockManager.Panels[0].ParentPanel as DockPanel;
                        if (container != null)
                        {
                            pb.DockAsTab(container);
                        }
                    }

                    pb.ClosedPanel += (senderX, eX) =>
                    {
                        dockManager.RemovePanel(pb);
                    };


                    control.Dock = DockStyle.Fill;
                    pb.ControlContainer.Controls.Add(control);
                    pb.ID   = vci.GUID;
                    pb.Name = vci.GUID + "_" + control.Name;
                    pb.Text = vci.Name;
                }
                else
                {
                    DockPanel dockPanel1 = dockManager.AddPanel(DockingStyle.Top);
                    dockPanel1.ID        = ee.Vci.GUID;
                    dockPanel1.Text      = control.VisualControlInfo.Name;
                    dockPanel1.Height    = 400;
                    dockPanel1.FloatSize = new Size(500, 400);

                    control.Dock = DockStyle.Fill;
                    dockPanel1.ControlContainer.Controls.Add(control);
                }

                //start control
                control.Start(core.controls.VisualControlStartingKind.StartingNew, ee.DataObject);
            }
        }
Example #3
0
 private void HandleOpenPanelRequestEvent(object sender, OpenPanelRequestEvent e)
 {
     _openRequests.Enqueue(e);
     ConsumeQueue();
 }