Esempio n. 1
0
        private bool _timersStarted;                   // TRUE if the timers have already been started

        /// <summary>
        ///   CTOR
        /// </summary>
        /// <param name = "id">the id of this mgdata object</param>
        /// <param name = "parent">the parent MGData</param>
        /// <param name = "isModal">true for modal windows</param>
        internal MGData(int id, MGData parent, bool isModal)
        {
            CmdsToServer   = new CommandsTable();
            CmdsToClient   = new CommandsTable();
            _timerHandlers = new HandlersTable();
            _expHandlers   = new HandlersTable();
            _mprgTab       = new TasksTable();
            _tasksTab      = new TasksTable();

            _id     = id;
            _parent = parent;

            if (ClientManager.Instance.EventsManager.getCompMainPrgTab() == null)
            {
                var compMainPrgTab = new CompMainPrgTable();
                ClientManager.Instance.EventsManager.setCompMainPrgTab(compMainPrgTab);
            }

            IsModal = isModal;
        }
Esempio n. 2
0
        /// <summary>
        ///   init the position to start a new chain of search
        /// </summary>
        internal void init(RunTimeEvent rtEvent)
        {
            _rtEvt = rtEvent;
            _task  = _rtEvt.getTask();
            if (_task.isMainProg())
            {
                //phase = PHASE_CONTROL_NON_SPECIFIC;
                _prevTask = _rtEvt.getMainPrgCreator();
                if (_prevTask != null && _prevTask.isMainProg())
                {
                    _prevTask = null;
                }
            }

            if (rtEvent.getType() == ConstInterface.EVENT_TYPE_USER_FUNC)
            {
                _phase = PHASE_CONTROL_NON_SPECIFIC;
            }
            else
            {
                if (rtEvent.getType() == ConstInterface.EVENT_TYPE_USER_FUNC)
                {
                    _phase = PHASE_CONTROL_NON_SPECIFIC;
                }
                else
                {
                    _phase = PHASE_CONTROL_SPECIFIC;
                }
            }

            _orgTask     = _task;
            _orgPrevTask = _prevTask;

            _handlersTab = _task.getHandlersTab();
            if (_handlersTab == null)
            {
                goUpTaskChain();
            }
            _handlerIdx = -1;
        }
Esempio n. 3
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);
        }