private void o2MessageQueue_onMessages(IO2Message o2Message) { //first thing to do is to make sure we are on the correct thread if (InvokeRequired) { Invoke(new EventHandler(delegate { o2MessageQueue_onMessages(o2Message); })); } else { if (o2Message is IM_GUIAction) { var mGuiAction = (IM_GUIAction)o2Message; PublicDI.log.info("O2GuiWithDockPanel received IM_GUIAction of action: {0}", mGuiAction.GuiAction); switch (mGuiAction.GuiAction) { case (IM_GUIActions.openControlInGui): O2DockPanel.loadControl(mGuiAction.controlType, mGuiAction.o2DockState, mGuiAction.controlName); break; case (IM_GUIActions.setAscxDockStateAndOpenIfNotAvailable): // if setDockState fails is because the control is not loaded if (false == O2DockUtils.setDockState(mGuiAction.controlName, mGuiAction.o2DockState)) { O2AscxGUI.openAscxASync(mGuiAction.controlTypeString, mGuiAction.o2DockState, mGuiAction.controlName); } break; } return; } } }
/// <summary> /// opens ascx control (Sync mode) /// </summary> /// <param name="ascxControlToLoad"></param> /// <param name="dockState"></param> /// <param name="guiWindowName"></param> public static Control openAscx(Type ascxControlToLoad, O2DockState dockState, String guiWindowName) { Control ascxControl = null; var sync = new AutoResetEvent(false); O2Thread.staThread(() => { ascxControl = O2DockPanel.loadControl(ascxControlToLoad, dockState, guiWindowName); sync.Set(); }); sync.WaitOne(); return(ascxControl); }
public static void addControlToMenu(Type ascxControlToLoad, O2DockState dockState, String guiWindowName) { O2DockPanel.addAscxControlToO2GuiWithDockPanelWithDockState(ascxControlToLoad, O2DockUtils.getDockStateFromO2DockState(dockState), guiWindowName, false); }
public static void openAscxASync(Type ascxControlToLoad, O2DockState dockState, String guiWindowName) { O2Thread.staThread(() => O2DockPanel.loadControl(ascxControlToLoad, dockState, guiWindowName)); }