private static void addControlToO2GuiWithDockPanelSync(O2GuiWithDockPanel o2GuiWithDockPanel, O2DockContent controlToAdd, EventWaitHandle controlAdded) { //if (controlToAdd.dockContent != null && controlToAdd.dockContent.okThread( // delegate { addControlToO2GuiWithDockPanelSync(controlToAdd, controlAdded); })) //{ //var sync = new AutoResetEvent(false); // add the control on the o2GuiThread //O2AscxGUI.o2GuiWithDockPanel.Invoke(new EventHandler(delegate { try { if (controlToAdd.createControlFromType()) { controlToAdd.dockContent.Show(o2GuiWithDockPanel.getDockPanel(), controlToAdd.dockState); if (controlToAdd.dockState == DockState.Float && controlToAdd.dockContent.TopLevelControl != null) { controlToAdd.dockContent.TopLevelControl.Width = controlToAdd.desiredWidth; controlToAdd.dockContent.TopLevelControl.Height = controlToAdd.desiredHeight; } if (controlToAdd.dockState == DockState.Document) { if (O2AscxGUI.o2GuiWithDockPanel.Width < controlToAdd.desiredWidth) { O2AscxGUI.o2GuiWithDockPanel.Width = controlToAdd.desiredWidth + 10; } if (O2AscxGUI.o2GuiWithDockPanel.Height < controlToAdd.desiredHeight + 100) { O2AscxGUI.o2GuiWithDockPanel.Height = controlToAdd.desiredHeight + 100; } } O2DockUtils.addO2DockContentToDIGlobalVar(controlToAdd); } } catch (Exception ex) { PublicDI.log.ex(ex, "in addControlToO2GuiWithDockPanelSync"); } controlAdded.Set(); // })); //} //controlAdded.WaitOne(); }
private static void addControlToO2GuiWithDockPanelSync(O2GuiWithDockPanel o2GuiWithDockPanel, O2DockContent controlToAdd, EventWaitHandle controlAdded) { //if (controlToAdd.dockContent != null && controlToAdd.dockContent.okThread( // delegate { addControlToO2GuiWithDockPanelSync(controlToAdd, controlAdded); })) //{ //var sync = new AutoResetEvent(false); // add the control on the o2GuiThread //O2AscxGUI.o2GuiWithDockPanel.Invoke(new EventHandler(delegate { try { if (controlToAdd.createControlFromType()) { controlToAdd.dockContent.Show(o2GuiWithDockPanel.getDockPanel(), controlToAdd.dockState); if (controlToAdd.dockState == DockState.Float && controlToAdd.dockContent.TopLevelControl != null) { controlToAdd.dockContent.TopLevelControl.Width = controlToAdd.desiredWidth; controlToAdd.dockContent.TopLevelControl.Height = controlToAdd.desiredHeight; } if (controlToAdd.dockState == DockState.Document) { if (O2AscxGUI.o2GuiWithDockPanel.Width < controlToAdd.desiredWidth) O2AscxGUI.o2GuiWithDockPanel.Width = controlToAdd.desiredWidth + 10; if (O2AscxGUI.o2GuiWithDockPanel.Height < controlToAdd.desiredHeight + 100) O2AscxGUI.o2GuiWithDockPanel.Height = controlToAdd.desiredHeight + 100; } O2DockUtils.addO2DockContentToDIGlobalVar(controlToAdd); } } catch(Exception ex) { PublicDI.log.ex(ex, "in addControlToO2GuiWithDockPanelSync"); } controlAdded.Set(); // })); //} //controlAdded.WaitOne(); }