/// <summary> /// Show Dialog /// </summary> public virtual DialogResult openDialog() { DialogResult result = DialogResult.None; if (!Misc.IsGuiThread()) { // always execute dialog opening code in GUI thread GuiInteractive guiUtils = new GuiInteractive(); result = guiUtils.openDialog(this); } else { #if !PocketPC //Create dummy form and pass it as owner, //otherwise while running through F7 dialog is not displayed var dummyForm = GuiUtilsBase.createDummyForm(); dummyForm.Visible = false; GuiCommandQueue.getInstance().GuiThreadIsAvailableToProcessCommands = false; result = _form.ShowDialog(dummyForm); dummyForm.Close(); #else GuiCommandQueue.getInstance().GuiThreadIsAvailableToProcessCommands = false; result = _form.ShowDialog(); #endif } return(result); }
/// <summary> /// Methods for various commands are called synchronously here /// </summary> internal void Run() { GuiCommandQueue.getInstance().Run(); var contextIDGuard = new Manager.ContextIDGuard(_contextID); try { switch (_commandType) { case CommandType.PRINTPREVIEW_SET_CURSOR: onSetCursor(); break; case CommandType.PRINTPREVIEW_START: onStart(); break; case CommandType.PRINTPREVIEW_UPDATE: onUpdate(); break; case CommandType.CREATE_RICH_WINDOW: onCreateRichWindow(); break; case CommandType.PRINTPREVIEW_CLOSE: onClose(); break; case CommandType.PRINTPREVIEW_GETACTIVEFORM: onGetActiveForm(); break; case CommandType.CREATE_WINDOW: onCreateWindow(); break; case CommandType.DESTROY_WINDOW: onDestroyWindow(); break; case CommandType.PRINTPREVIEW_SHOW: onShow(); break; case CommandType.SHOW_PRINT_DIALOG: onShowPrintDialog(); break; case CommandType.ACTIVATE_PRINT_PREVIEW: OnActivatePrintPreview(); break; } } finally { contextIDGuard.Dispose(); // Reset the current contextID. } }
/// <summary> Catch the enable/disable of the soft keyboard. When the keyboard state changes, /// resize the active form and scroll to the control in focus /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void inputPanel_EnabledChanged(object sender, EventArgs e) { // Get the active form ClientManager cm = ClientManager.Instance; tasks.Task task = cm.getLastFocusedTask(); if (task == null) { return; } MgForm mgForm = (MgForm)cm.getLastFocusedTask().getForm(); if (mgForm == null) { return; } mgForm = (MgForm)mgForm.getTopMostForm(); Form form = GuiCommandQueue.getInstance().mgFormToForm(mgForm); // If form size changed if (form != null && form.Bounds != _inputPanel.VisibleDesktop) { Size changeFormSizeTo; if (_inputPanel.Enabled || _previousSize == null) { // remember the form's size before the soft keyboard was opened _previousSize = form.Size; changeFormSizeTo = _inputPanel.VisibleDesktop.Size; } else { // use the size from before the soft keyboard was opened - the VisibleDesktop ignores // the menu bar size changeFormSizeTo = _previousSize; } // Set the new size. The .Net way of changing the bounds does not work in this case, // so lets do it via win32 functions NativeWindowCommon.SetWindowPos(form.Handle, IntPtr.Zero, 0, 0, changeFormSizeTo.Width, changeFormSizeTo.Height, NativeWindowCommon.SWP_NOMOVE | NativeWindowCommon.SWP_NOZORDER); // Find the control in focus and scroll to it MapData mapData = ((TagData)form.Tag).LastFocusedMapData; GuiMgControl guiMgcontrol = mapData.getControl(); if (guiMgcontrol == null) { return; } object o = ControlsMap.getInstance().object2Widget(guiMgcontrol, mapData.getIdx()); Control control = null; LogicalControl logicalControl = null; if (o is LogicalControl) { logicalControl = (LogicalControl)o; control = logicalControl.getEditorControl(); } else { control = (Control)o; } GuiUtils.scrollToControl(control, logicalControl); } }
/// <summary> /// Creates a ToolStripMenuItem for menuEntry. /// </summary> /// <param name="menuReference"></param> /// <param name="windowMenuEntry"></param> /// <param name="mgForm"></param> /// <param name="menuStyle"></param> /// <param name="index"></param> public static void CreateMenuItem(MenuReference menuReference, GuiMenuEntry menuEntry, GuiMgForm mgForm, MenuStyle menuStyle, int index) { GuiCommandQueue.getInstance().createMenuItem(menuEntry, menuReference, menuStyle, true, index, mgForm); }