Пример #1
0
        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());
            }
        }
Пример #2
0
        /// <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);
        }