public static void addDefaultControlsToMenu() { O2AscxGUI.addControlToMenu(typeof(DirectoryViewer), O2DockState.Float, "Directory Viewer"); O2AscxGUI.addControlToMenu(typeof(FileMappings), O2DockState.Float, "Files Mappings"); O2AscxGUI.addControlToMenu(typeof(O2ObjectModel), O2DockState.Float, "O2 Object Model"); O2AscxGUI.addControlToMenu(typeof(ascx_FindingsViewer), O2DockState.Float, "Findings Viewer"); }
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; } } }
private void loadedO2ModuleToolStripMenuItem_Click(object sender, EventArgs e) { if (sender is ToolStripMenuItem) { var toolStripItem = (ToolStripMenuItem)sender; if (toolStripItem.Tag is O2DockContent) { var o2DockPanel = (O2DockContent)toolStripItem.Tag; var uniqueControlName = o2DockPanel.name; if (O2AscxGUI.isAscxLoaded(o2DockPanel.name)) { uniqueControlName += " " + Guid.NewGuid(); } O2AscxGUI.openAscxASync(o2DockPanel.type, O2DockState.Float, uniqueControlName); } } }
private static void o2MessageQueue_onMessages(IO2Message o2Message) { try { 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.isAscxGuiAvailable: isAscxGuiAvailable(); break; // case (IM_GUIActions.openControlInGui): // don't handle these here case IM_GUIActions.getGuiAscx: if (mGuiAction.returnDataCallback != null) { mGuiAction.returnDataCallback(O2DockUtils.getAscx(mGuiAction.controlName)); } break; case IM_GUIActions.executeOnAscx: if (mGuiAction.controlName == null || mGuiAction.targetMethod == null || mGuiAction.methodParameters == null) { PublicDI.log.error( "in O2Environment.O2MessagesHandler.o2MessageQueue_onMessages received a O2Message for IM_GUIActions.executeOnAscx, but either the targetMethod or methodParameters are null"); } else { var ascxControlToExecute = O2AscxGUI.getAscx(mGuiAction.controlName); if (ascxControlToExecute == null) { PublicDI.log.error( "in O2MessagesHandler...IM_GUIActions.executeOnAscx, could not get control: {0}", mGuiAction.controlName); } else { o2Message.returnData = PublicDI.reflection.invoke(ascxControlToExecute, mGuiAction.targetMethod, mGuiAction.methodParameters); } } break; case IM_GUIActions.closeAscxParent: O2AscxGUI.closeAscxParent(mGuiAction.controlName); break; case IM_GUIActions.openControlInGui: // this is a special case since we should only handle this if the main GUI is not loaded if (false == O2AscxGUI.isGuiLoaded()) // this tends to happen on Unit tests where we only have one control loaded { // and if the Gui is not loaded open this control as a stand alone FORM O2AscxGUI.openAscxAsForm(mGuiAction.controlType, mGuiAction.controlName); } break; } } } catch (Exception ex) { PublicDI.log.ex(ex, " in O2MessagesHandler.o2MessageQueue_onMessages"); } }
private void whichDirectoryIsThisO2ModuleRunningFromToolStripMenuItem_Click(object sender, EventArgs e) { //PublicDI.log.showMessageBox(PublicDI.config.CurrentExecutableDirectory, "This O2 module is running from:", // MessageBoxButtons.OK); O2AscxGUI.openAscxASync(typeof(ascx_O2InstallAndTempDirectories), O2DockState.Float, "O2 Install and Temp Directories"); }