/// <summary> /// execute all pending commands - create the equivalent local commands and invoke its' execute method /// </summary> /// <param name="sendingInstruction"></param> /// <param name="sessionStage"></param> /// <param name="res"></param> internal override void Execute(SendingInstruction sendingInstruction, SessionStage sessionStage, IResultValue res) { MGDataCollection mgDataTab = MGDataCollection.Instance; // loop on all MGData for (int i = 0; i < mgDataTab.getSize(); i++) { MGData mgd = mgDataTab.getMGData(i); if (mgd != null && !mgd.IsAborting) { CommandsTable commands = mgd.CmdsToServer; // go over all commands while (commands.getSize() > 0) { // extract command from CmdsToServer IClientCommand command = commands.ExtractCommand(0); LocalRunTimeCommandBase localRunTimeCommand = _localRunTimeCommandFactory.CreateLocalRunTimeCommand(command); localRunTimeCommand.Execute(); } Debug.Assert(mgd.CmdsToClient.getSize() == 0, "Not all commands were executed"); } } }
/// <summary>process "timer" event</summary> /// <param name = "mgTimer">object of 'MgTimer' class</param> internal void ProcessTimer(MgTimer mgTimer) { MGData mgd = ((RCTimer)mgTimer).GetMgdata(); var task = mgd.getFirstTask(); // MgTimer/RCTimer uses interval in milliseconds but RuntimeEvent uses interval in seconds // so convert it to seconds. int seconds = (((RCTimer)mgTimer).TimerIntervalMiliSeconds) / 1000; bool isIdle = ((RCTimer)mgTimer).IsIdleTimer; if (mgd.IsAborting) { return; } var rtEvt = new RunTimeEvent(task, true); rtEvt.setTimer(seconds, mgd.GetId(), isIdle); rtEvt.setMainPrgCreator(rtEvt.getTask()); if (!isIdle) { rtEvt.setCtrl((MgControl)task.getLastParkedCtrl()); } rtEvt.setInternal(InternalInterface.MG_ACT_TIMER); ClientManager.Instance.EventsManager.addToTail(rtEvt); }
/// <summary> /// stop the timer /// </summary> /// <param name = "MgData"> MgData</param> /// <param name = "seconds">interval in full seconds to invoke the function (from current time)</param> /// <param name = "isIdleTimer">true if this timer is the idle timer</param> internal void stopTimer(MGData mgData, int seconds, bool isIdleTimer) { if (seconds > 0) { //RCTimer/MgTimer works on milliseconds so convert seconds to milliseconds RCTimer.StopTimer(mgData, seconds * 1000, isIdleTimer); } }
/// <summary> /// start a timer /// </summary> /// <param name = "mgd"> MgData </param> /// <param name = "seconds">interval in full seconds to invoke the function (from current time)</param> /// <param name = "isIdleTimer">true if this timer is the idle timer</param> internal void startTimer(MGData mgData, int seconds, bool isIdleTimer) { if (seconds > 0) { //RCTimer/MgTimer works on milliseconds so convert seconds to milliseconds RCTimer objRCTimer = new RCTimer(mgData, seconds * 1000, isIdleTimer); Commands.addAsync(CommandType.START_TIMER, objRCTimer); // fixed bug 284566, while we have command in he queue, execute them Commands.beginInvoke(); } }
internal override void Execute() { MGData firstMgData = MGDataCollection.Instance.getMGData(0); Task MainPrg = firstMgData.getMainProg(0); while (MainPrg != null) { MainPrg.handleTaskSuffix(false); MainPrg = firstMgData.getNextMainProg(MainPrg.getCtlIdx()); } }
/// <summary> /// Release references to mgData and to the task in order to let the gc to free the memory. /// This code was moved from processClose in order to clean also when the "open window = NO" (non interactive tasks). /// </summary> /// <param name = "form"></param> internal void processDispose(GuiMgForm guiMgForm) { var form = (MgForm)guiMgForm; var task = (Task)form.getTask(); MGData mgd = task.getMGData(); RCTimer.StopAll(mgd); if (mgd.IsAborting) { MGDataCollection.Instance.deleteMGDataTree(mgd.GetId()); } }
/// <summary> /// start timers for timer events /// </summary> internal void startTimers(MGData mgd) { List<Int32> timers; GUIManager guiManager = GUIManager.Instance; if (_handlers != null) { timers = getTimersVector(); for (int i = 0; i < timers.Count; i++) guiManager.startTimer(mgd, timers[i], false); } }
/// <summary> /// should not be called for Query and for IniputForceWrite: /// </summary> /// <returns></returns> private String SerializeRecords() { StringBuilder message = new StringBuilder(); try { MGData currMGData = MGDataCollection.Instance.getCurrMGData(); int length = currMGData.getTasksCount(); bool titleExist = false; Task currFocusedTask = ClientManager.Instance.getLastFocusedTask(); for (int i = 0; i < length; i++) { Task task = currMGData.getTask(i); var ctrl = (MgControl)task.getLastParkedCtrl(); if (ctrl != null && task.KnownToServer && !task.IsOffline) { if (!titleExist) { message.Append(" " + ConstInterface.MG_ATTR_FOCUSLIST + "=\""); titleExist = true; } else { message.Append('$'); } message.Append(task.getTaskTag() + ","); message.Append((task.getLastParkedCtrl()).getDitIdx()); } } if (titleExist) { message.Append("\""); } if (currFocusedTask != null && !currFocusedTask.IsOffline) { message.Append(" " + ConstInterface.MG_ATTR_FOCUSTASK + "=\"" + currFocusedTask.getTaskTag() + "\""); } } catch (Exception ex) { Logger.Instance.WriteExceptionToLog(ex); } return(message.ToString()); }
/// <summary> /// Check if this event is blocked by the currently active window. If the /// current window is modal, and the event defined in one of its ancestors, /// the event should not be executed. /// </summary> /// <param name = "activeWindowData">The MGData object describing the currently active window.</param> /// <returns> /// The method returns true if the currently active window is modal is a /// descendant of the event's task. Otherwise it returns false. /// </returns> internal bool isBlockedByModalWindow(MGData activeWindowData) { if (activeWindowData.IsModal) { // Check that the event's task is an ancestor of the active window's task. Task eventTask = getTask(); Task baseTask = activeWindowData.getTask(0); if (eventTask != baseTask && baseTask.isDescendentOf(eventTask)) { return(true); } } return(false); }
/// <summary> /// Get .Net assembly file name specified by url in local file system /// </summary> /// <param name="url"></param> /// <returns></returns> private String GetDNAssemblyFile(String url) { // Since .NET assemblies are loaded dynamically in ReflectionServices, it is difficult to get the task that is // trying to load the assembly. However, getCurrMGData().getFirstTask() serves our purpose as the task is used // only to get commands processor TaskBase task = MGDataCollection.Instance.getCurrMGData().getFirstTask(); // At the time of loading .net assembly for initializing the .net objects in main program, getFirstTask () returns // null if the main program does not have MDI frame. Then use main program to get the commands processor. if (task == null) { MGData mgd = MGDataCollection.Instance.getMGData(0); task = mgd.getMainProg(0); } return(GetLocalFileName(url, task)); }
/// <summary> /// Loads the program whose task id is 'startupProgram' into the appropriate /// MGData instance. /// </summary> internal void LoadStartupProgram() { Debug.Assert(startupProgram != null); if (ClientManager.Instance.LocalManager.ApplicationDefinitions.TaskDefinitionIdsManager.CanExecuteTask(startupProgram)) { Task mainProg = MGDataCollection.Instance.GetMainProgByCtlIdx(0); MGData mgd = MGDataCollection.Instance.GetMGDataForStartupProgram(); int mgdId = mgd.GetId(); string taskUrl = LocalRunTimeCommandOpenTask.getXmlTaskURL(ClientManager.Instance.LocalManager.ApplicationDefinitions.TaskDefinitionIdsManager, startupProgram); ClientManager.Instance.ProcessResponse(taskUrl, mgdId, new OpeningTaskDetails(mainProg, mainProg, null), null); } else { throw new ApplicationException(ClientManager.Instance.getMessageString(MsgInterface.CSTIO_STR_ERR2)); } }
/// <summary> /// /// </summary> private void ExecuteAbortCommand() { MGDataTable mgDataTab = MGDataTable.Instance; int oldMgdID = MGDataTable.Instance.currMgdID; MGData mgd = null; var task = (Task)mgDataTab.GetTaskByID(TaskTag); // Pass transaction ownership if (_transOwner != null) { var newTransOwnerTask = (Task)mgDataTab.GetTaskByID(_transOwner); if (newTransOwnerTask != null) { newTransOwnerTask.setTransOwnerTask(); } } // On special occasions, the server may send abort commands on tasks which were not parsed yet if (task == null && ClientManager.Instance.EventsManager.ignoreUnknownAbort()) { return; } Debug.Assert(task != null); mgd = task.getMGData(); task.stop(); mgd.abort(); MGDataTable.Instance.currMgdID = mgd.GetId(); GUIManager.Instance.abort((MgForm)task.getForm()); MGDataTable.Instance.currMgdID = (mgd.GetId() != oldMgdID || mgd.getParentMGdata() == null ? oldMgdID : mgd.getParentMGdata().GetId()); if (!ClientManager.Instance.validReturnToCtrl()) { MgControl mgControl = GUIManager.getLastFocusedControl(); ClientManager.Instance.ReturnToCtrl = mgControl; if (mgControl != null)// Refresh the status bar. { ((MgForm)mgControl.getForm()).RefreshStatusBar(); } } }
/// <summary> /// execute the command - add the command to the pending client commands and execute them /// </summary> /// <param name="command"></param> internal void Execute(IClientCommand command) { MGDataCollection mgDataTab = MGDataCollection.Instance; mgDataTab.currMgdID = MGDataCollection.Instance.currMgdID; MGData mgd = mgDataTab.getCurrMGData(); // Add the command to the queue mgd.CmdsToClient.Add(command); try { // execute the command mgd.CmdsToClient.Execute(null); } catch (Exception) { mgd.CmdsToClient.clear(); throw; } }
/// <summary> /// get the next task in the tasks chain and returns false if no task was found. /// this function changes the phase variable accordingly /// </summary> private bool goUpTaskChain() { MGData mgd = _task.getMGData(); int ctlIdx = _task.getCtlIdx(); //handlers for events for .NET object must be in the same task (not including control) if (_rtEvt.DotNetObject != null) { if (_phase != PHASE_CONTROL_NON_SPECIFIC) //QCR #940545, check only the same tasks { _phase++; //go to the next phase return(true); } else { return(false); } } switch (_phase) { /*case PHASE_CONTROL_SPECIFIC: * phase = PHASE_CONTROL_NON_SPECIFIC; * break;*/ case PHASE_CONTROL_SPECIFIC: case PHASE_CONTROL_NON_SPECIFIC: // non specific handlers are searched till we hit our main program (inclusive) // afterwards we switch to global phase. if (!_task.isMainProg()) { getParentOrCompMainPrg(); break; } else { // internal, internal, system and user events may cross component bounderies if ((_rtEvt.getType() == ConstInterface.EVENT_TYPE_PUBLIC || _rtEvt.getType() == ConstInterface.EVENT_TYPE_INTERNAL || _rtEvt.getType() == ConstInterface.EVENT_TYPE_SYSTEM || _rtEvt.getType() == ConstInterface.EVENT_TYPE_USER) && ctlIdx != 0) { // load the RT parent of the previous task. If no prevtask exists then we are // simply running on the main progs list (for example, when a main prg catches // a timer event, no prevtask exists. if (_prevTask == null) { _task = (Task)mgd.getNextMainProg(ctlIdx); if (_task == null && ctlIdx != 0) { _task = MGDataCollection.Instance.GetMainProgByCtlIdx(ClientManager.Instance.EventsManager.getCompMainPrgTab().getCtlIdx(0)); } } else { // the component main program that was set in getParentOrCompMainPrg, is now replaced back to the path parent. _task = _prevTask.PathParentTask; _prevTask = null; } _rtEvt.setMainPrgCreator(null); //moving out of a main program to another task break; } // here we scan the main progs according to the load sequence (first to last). if (_phase == PHASE_CONTROL_SPECIFIC) { // specific search is over. start the non specific search from // the first task. _phase = PHASE_GLOBAL_SPECIFIC; } else { // here we scan the main progs according to the load sequence (first to last). _phase = PHASE_GLOBAL; } _task = MGDataCollection.Instance.GetMainProgByCtlIdx(ClientManager.Instance.EventsManager.getCompMainPrgTab().getCtlIdx(0)); _rtEvt.setMainPrgCreator(_task); if (_task == null) { return(false); } break; } case PHASE_GLOBAL_SPECIFIC: case PHASE_GLOBAL: _task = (Task)mgd.getNextMainProg(ctlIdx); if (_task == null) { if (_phase == PHASE_GLOBAL) { return(false); } // PHASE_GLOBAL_SPECIFIC else { // specific search is over. start the non specific search from // the first task. _phase = PHASE_CONTROL_NON_SPECIFIC; _task = _orgTask; _prevTask = _orgPrevTask; break; } } break; default: Logger.Instance.WriteExceptionToLog("in EventHandlerPosition.goUpTaskChain() invalid phase: " + _phase); break; } if (_task == null) { return(false); } _handlersTab = _task.getHandlersTab(); if (_handlersTab == null) { return(goUpTaskChain()); } _handlerIdx = -1; return(true); }
public override void Execute(rt.IResultValue res) { MGData mgd = null; MGDataCollection mgDataTab = MGDataCollection.Instance; bool destinationSubformSucceeded = false; bool refreshWhenHidden = true; int mgdID = 0; MgControl subformCtrl = null; List <Int32> oldTimers = new List <Int32>(), newTimers = new List <Int32>(); bool moveToFirstControl = true; Task guiParentTask; MGData guiParentMgData = null; Task callingTask = (_callingTaskTag != null ? (Task)mgDataTab.GetTaskByID(_callingTaskTag) : null); Task pathParentTask = (_pathParentTaskTag != null ? (Task)mgDataTab.GetTaskByID(_pathParentTaskTag) : null); MgForm formToBeActivatedOnClosingCurrentForm = null; Task lastFocusedTask = ClientManager.Instance.getLastFocusedTask(); if (lastFocusedTask != null && lastFocusedTask.IsOffline) { formToBeActivatedOnClosingCurrentForm = (MgForm)lastFocusedTask.getForm(); } // TODO (Ronak): It is wrong to set Parent task as a last focus task when // non-offline task is being called from an offline task. //When a nonOffline task was called from an Offline task (of course via MP event), //the calling task id was not sent to the server because the server is unaware of the //offline task. So, when coming back from the server, assign the correct calling task. //Task lastFocusedTask = ClientManager.Instance.getLastFocusedTask(); //if (lastFocusedTask != null && lastFocusedTask.IsOffline) // _callingTaskTag = lastFocusedTask.getTaskTag(); guiParentTask = callingTask = (Task)mgDataTab.GetTaskByID(_callingTaskTag); if (callingTask != null) { mgd = callingTask.getMGData(); } //QCR#712370: we should always perform refreshTables for the old MgData before before opening new window ClientManager.Instance.EventsManager.refreshTables(); //ditIdx is send by server only for subform opening for refreshWhenHidden if ((_subformCtrlName != null) || (_ditIdx != Int32.MinValue)) { subformCtrl = (_ditIdx != Int32.MinValue ? (MgControl)callingTask.getForm().getCtrl(_ditIdx) : ((MgForm)callingTask.getForm()).getSubFormCtrlByName(_subformCtrlName)); if (subformCtrl != null) { var subformTask = subformCtrl.getSubformTask(); guiParentTask = (Task)subformCtrl.getForm().getTask(); mgdID = guiParentTask.getMgdID(); guiParentMgData = guiParentTask.getMGData(); if (guiParentMgData.getTimerHandlers() != null) { oldTimers = guiParentMgData.getTimerHandlers().getTimersVector(); } if (_ditIdx != Int32.MinValue) //for refresh when hidden { refreshWhenHidden = false; moveToFirstControl = false; } else //for destination { destinationSubformSucceeded = true; // Pass transaction ownership if (_transOwner != null) { var newTransOwnerTask = (Task)mgDataTab.GetTaskByID(_transOwner); if (newTransOwnerTask != null) { newTransOwnerTask.setTransOwnerTask(); } } if (subformTask != null) { subformTask.setDestinationSubform(true); subformTask.stop(); } if (!ClientManager.Instance.validReturnToCtrl()) { ClientManager.Instance.ReturnToCtrl = GUIManager.getLastFocusedControl(); } } subformCtrl.setSubformTaskId(_newId); } } MGData parentMgData; if (callingTask == null) { parentMgData = MGDataCollection.Instance.getMGData(0); } else { parentMgData = callingTask.getMGData(); } if (!destinationSubformSucceeded && refreshWhenHidden) { mgdID = mgDataTab.getAvailableIdx(); Debug.Assert(mgdID > 0); mgd = new MGData(mgdID, parentMgData, _isModal, _forceModal); mgd.copyUnframedCmds(); MGDataCollection.Instance.addMGData(mgd, mgdID, false); MGDataCollection.Instance.currMgdID = mgdID; } Obj = _key; _key = null; try { // Large systems appear to consume a lot of memory, the garbage collector is not always // "quick" enough to catch it, so free memory before initiating a memory consuming job as // reading a new MGData. if (GC.GetTotalMemory(false) > 30000000) { GC.Collect(); } ClientManager.Instance.ProcessResponse(NewTaskXML, mgdID, new OpeningTaskDetails(callingTask, pathParentTask, formToBeActivatedOnClosingCurrentForm), null); } finally { ClientManager.Instance.EventsManager.setIgnoreUnknownAbort(false); } if (callingTask != null && subformCtrl != null) { callingTask.PrepareForSubform(subformCtrl); } if (destinationSubformSucceeded || !refreshWhenHidden) { subformCtrl.initSubformTask(); if (destinationSubformSucceeded) { var subformTask = subformCtrl.getSubformTask(); moveToFirstControl = !callingTask.RetainFocus; subformTask.setIsDestinationCall(true); } } if (subformCtrl != null) { if (guiParentMgData.getTimerHandlers() != null) { newTimers = guiParentMgData.getTimerHandlers().getTimersVector(); } guiParentMgData.changeTimers(oldTimers, newTimers); } Task nonInteractiveTask = ClientManager.Instance.StartProgram(destinationSubformSucceeded, moveToFirstControl, _varList, _returnVal, null); if (destinationSubformSucceeded || !refreshWhenHidden) { guiParentTask.resetRcmpTabOrder(); } // in local tasks, ismodal is calculated after the main display, so we need to update the command member _isModal = mgd.IsModal; // If we have a non interactive task starting, we need to create an eventLoop for it , just like modal. // This is because we cannot allow the tasks above it to catch events. if (nonInteractiveTask == null) { // a non interactive parent will cause the called task to behave like modal by having its own events loop. // In case of main program caller (which is flagged as non interactive) we will have a new events loop for the called program // if the main program is without a form. If the main prog has a form , then the callee can be included in the main prog loop. if (callingTask != null && ((_isModal && !destinationSubformSucceeded && refreshWhenHidden) || (!callingTask.IsInteractive && (!callingTask.isMainProg() || callingTask.getForm() == null)))) { ClientManager.Instance.EventsManager.EventsLoop(mgd); } } else { ClientManager.Instance.EventsManager.NonInteractiveEventsLoop(mgd, nonInteractiveTask); } }
/// <summary> /// part of the buildXML which deals with the command only - used for command serialization unit test /// </summary> /// <param name="message"></param> /// <param name="execStackExists"></param> /// <returns></returns> internal void BuildXMLInternal(StringBuilder message, bool execStackExists) { bool hasChildElements = false; message.Append(XMLConstants.START_TAG + ConstInterface.MG_TAG_COMMAND); message.Append(" " + XMLConstants.MG_ATTR_TYPE + "=\""); switch (Type) { case ClientCommandType.VerifyCache: message.Append(ConstInterface.MG_ATTR_VAL_VERIFY_CACHE); break; case ClientCommandType.Event: message.Append(ConstInterface.MG_ATTR_VAL_EVENT); break; case ClientCommandType.Recompute: message.Append(ConstInterface.MG_ATTR_VAL_RECOMP); break; case ClientCommandType.Transaction: message.Append(ConstInterface.MG_ATTR_VAL_TRANS); break; case ClientCommandType.Unload: message.Append(ConstInterface.MG_ATTR_VAL_UNLOAD); break; case ClientCommandType.Hibernate: message.Append(ConstInterface.MG_ATTR_VAL_HIBERNATE); break; case ClientCommandType.Resume: message.Append(ConstInterface.MG_ATTR_VAL_RESUME); break; case ClientCommandType.ExecOper: message.Append(ConstInterface.MG_ATTR_VAL_EXEC_OPER); break; case ClientCommandType.Menu: message.Append(ConstInterface.MG_ATTR_VAL_MENU); break; case ClientCommandType.Evaluate: message.Append(ConstInterface.MG_ATTR_VAL_EVAL); break; case ClientCommandType.OpenURL: message.Append(ConstInterface.MG_ATTR_VAL_OPENURL); break; case ClientCommandType.Query: message.Append(ConstInterface.MG_ATTR_VAL_QUERY); break; case ClientCommandType.Expand: message.Append(ConstInterface.MG_ATTR_VAL_EXPAND); break; case ClientCommandType.IniputForceWrite: message.Append(ConstInterface.MG_ATTR_VAL_INIPUT_FORCE_WRITE); break; default: Logger.Instance.WriteErrorToLog("in Command.buildXML() no such type: " + Type); break; } message.Append("\""); if (TaskTag != null && !execStackExists) { // QCR #980454 - the task id may change during the task's lifetime, so taskId might // be holding the old one - find the task and refetch its current ID. String id = MGDataTable.Instance.getTaskIdById(TaskTag); message.Append(" " + XMLConstants.MG_ATTR_TASKID + "=\"" + id + "\""); } if (_oper != 0) { message.Append(" " + ConstInterface.MG_ATTR_OPER + "=\"" + _oper + "\""); } if (_fldId != -1) { message.Append(" " + ConstInterface.MG_ATTR_FIELDID + "=\"" + _fldId + "\""); } if (_ignoreSubformRecompute) { message.Append(" " + ConstInterface.MG_ATTR_IGNORE_SUBFORM_RECOMPUTE + "=\"" + 1 + "\""); } if (_handlerId != null && !execStackExists) { message.Append(" " + ConstInterface.MG_ATTR_HANDLERID + "=\"" + _handlerId + "\""); } if (MagicEvent != 0) { message.Append(" " + ConstInterface.MG_ATTR_MAGICEVENT + "=\"" + MagicEvent + "\""); } if (rollbackType != RollbackEventCommand.RollbackType.NONE) { message.Append(" " + ConstInterface.MG_ATTR_ROLLBACK_TYPE + "=\"" + (char)rollbackType + "\""); } if (_exitByMenu) { message.Append(" " + ConstInterface.MG_ATTR_EXIT_BY_MENU + "=\"" + "=\"1\""); } if (_operIdx > Int32.MinValue && !execStackExists) { message.Append(" " + ConstInterface.MG_ATTR_OPER_IDX + "=\"" + _operIdx + "\""); } if (_ditIdx > Int32.MinValue) { message.Append(" " + XMLConstants.MG_ATTR_DITIDX + "=\"" + _ditIdx + "\""); } if (_val != null) { message.Append(" " + XMLConstants.MG_ATTR_VALUE + "=\"" + XmlParser.escape(_val) + "\""); } if (_expIdx > Int32.MinValue) { message.Append(" " + ConstInterface.MG_ATTR_EXP_IDX + "=\"" + _expIdx + "\""); } if (_expType != StorageAttribute.NONE) { String maxDigits = ""; if (_lengthExpVal > 0) { maxDigits += _lengthExpVal; } message.Append(" " + ConstInterface.MG_ATTR_EXP_TYPE + "=\"" + (char)_expType + maxDigits + "\""); } if (!_reversibleExit) { message.Append(" " + ConstInterface.MG_ATTR_REVERSIBLE + "=\"0\""); } if (_varList != null) { message.Append(" " + ConstInterface.MG_ATTR_ARGLIST + "=\""); _varList.buildXML(message); message.Append("\""); } if (_generation != null) { message.Append(" " + ConstInterface.MG_ATTR_GENERATION + "=\"" + _generation + "\""); } if (_taskVarList != null) { message.Append(" " + ConstInterface.MG_ATTR_TASKVARLIST + "=\"" + _taskVarList + "\""); } if (Obj != null) { message.Append(" " + ConstInterface.MG_ATTR_OBJECT + "=\"" + Obj + "\""); } if (_mprgCreator != null) { message.Append(" " + ConstInterface.MG_ATTR_MPRG_SOURCE + "=\"" + _mprgCreator.getTaskTag() + "\""); } if (_level != 0) { message.Append(" " + ConstInterface.MG_ATTR_TRANS_LEVEL + "=\"" + _level + "\""); } if (_key != null) { message.Append(" " + ConstInterface.MG_ATTR_KEY + "=\"" + _key + "\""); } if (RefreshMode != 0) { message.Append(" " + ConstInterface.MG_ATTR_REALREFRESH + "=\"" + (int)RefreshMode + "\""); } //this tag value alway when sent equals to 1 if (_keepUserSort) { message.Append(" " + ConstInterface.MG_ATTR_KEEP_USER_SORT + "=\"1\""); } if (SubformTaskTag != null) { message.Append(" " + ConstInterface.MG_ATTR_SUBFORM_TASK + "=\"" + SubformTaskTag + "\""); } //this tag value always when sent does not equal to 0 if (_menuUid > Int32.MinValue) { message.Append(" " + ConstInterface.MG_ATTR_MNUUID + "=\"" + _menuUid + "\""); } if (MenuComp > Int32.MinValue) { message.Append(" " + ConstInterface.MG_ATTR_MNUCOMP + "=\"" + MenuComp + "\""); } if (_closeSubformOnly) { message.Append(" " + ConstInterface.MG_ATTR_CLOSE_SUBFORM_ONLY + "=\"1\""); } if (_checkOnly) { message.Append(" " + ConstInterface.MG_ATTR_CHECK_ONLY + "=\"1\""); } if (_treePath != null) { message.Append(" " + ConstInterface.MG_ATTR_PATH + "=\"" + _treePath + "\""); } if (_treeValues != null) { message.Append(" " + ConstInterface.MG_ATTR_VALUES + "=\"" + _treeValues + "\""); } if (_treeIsNulls != null) { message.Append(" " + ConstInterface.MG_ATTR_TREE_IS_NULLS + "=\"" + _treeIsNulls + "\""); } if (_direction != -1) { message.Append(" " + ConstInterface.MG_ATTR_DIRECTION + "=\"" + _direction + "\""); } if (_incrmentalSearchString != null) { message.Append(" " + ConstInterface.MG_ATTR_SEARCH_STR + "=\"" + _incrmentalSearchString + "\""); } if (_resetIncrementalSearch) { message.Append(" " + ConstInterface.MG_ATTR_RESET_SEARCH + "=\"1\""); } if (_accessedCacheFiles != null && _accessedCacheFiles.Count > 0) { hasChildElements = true; message.Append(" " + ConstInterface.MG_ATTR_SHOULD_PRE_PROCESS + "=\"Y\""); message.Append(XMLConstants.TAG_CLOSE + "\n"); foreach (KeyValuePair <string, string> cachedFileInfo in _accessedCacheFiles) { message.Append(XMLConstants.XML_TAB + XMLConstants.XML_TAB + XMLConstants.TAG_OPEN); message.Append(ConstInterface.MG_TAG_CACHE_FILE_INFO + " "); message.Append(ConstInterface.MG_ATTR_SERVER_PATH + "=\"" + cachedFileInfo.Key + "\" "); message.Append(ConstInterface.MG_ATTR_TIMESTAMP + "=\"" + cachedFileInfo.Value + "\""); message.Append(XMLConstants.TAG_TERM + "\n"); } message.Append(XMLConstants.XML_TAB + XMLConstants.END_TAG + ConstInterface.MG_TAG_COMMAND); } switch (Type) { case ClientCommandType.Query: message.Append(" " + ConstInterface.MG_ATTR_VAL_QUERY_TYPE + "=\""); switch (_queryType) { case QueryType.GLOBAL_PARAMS: message.Append(ConstInterface.MG_ATTR_VAL_QUERY_GLOBAL_PARAMS); break; default: message.Append(ConstInterface.MG_ATTR_VAL_QUERY_CACHED_FILE); message.Append("\" "); message.Append(ConstInterface.MG_ATTR_FILE_PATH); message.Append("=\""); message.Append(_text); break; } message.Append("\""); break; case ClientCommandType.IniputForceWrite: _text = XmlParser.escape(_text); message.Append(" " + ConstInterface.MG_ATTR_VAL_INIPUT_PARAM + "=\"" + _text + "\""); break; default: try { MGData currMGData = MGDataTable.Instance.getCurrMGData(); int length = currMGData.getTasksCount(); bool titleExist = false; Task currFocusedTask = ClientManager.Instance.getLastFocusedTask(); for (int i = 0; i < length; i++) { Task task = currMGData.getTask(i); var ctrl = (MgControl)task.getLastParkedCtrl(); if (ctrl != null && task.KnownToServer && !task.IsOffline) { if (!titleExist) { message.Append(" " + ConstInterface.MG_ATTR_FOCUSLIST + "=\""); titleExist = true; } else { message.Append('$'); } message.Append(task.getTaskTag() + ","); message.Append((task.getLastParkedCtrl()).getDitIdx()); } } if (titleExist) { message.Append("\""); } if (currFocusedTask != null && !currFocusedTask.IsOffline) { message.Append(" " + ConstInterface.MG_ATTR_FOCUSTASK + "=\"" + currFocusedTask.getTaskTag() + "\""); } } catch (Exception ex) { Logger.Instance.WriteErrorToLog(ex); } break; } if (hasChildElements) { message.Append(XMLConstants.TAG_CLOSE); } else { message.Append(XMLConstants.TAG_TERM); } }