Beispiel #1
0
        /// <summary>
        /// Handles external event recieved via WM_UNDO
        /// </summary>
        /// <param name="guiMgCtrl">ctrl to which this message is received</param>
        private void OnUndo(GuiMgControl guiMgCtrl)
        {
            var rtEvt = new RunTimeEvent((MgControl)guiMgCtrl, ((MgControl)guiMgCtrl).getDisplayLine(false), true);

            rtEvt.setInternal(InternalInterface.MG_ACT_EDT_UNDO);
            ClientManager.Instance.EventsManager.addToTail(rtEvt);
        }
Beispiel #2
0
        /// <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);
        }
Beispiel #3
0
        /// <summary>
        ///   add Run Time Events to the events queue
        /// </summary>
        /// <param name = "foundTagName">possible tag name, name of object, which need be allocated</param>
        private bool initEvents(XmlParser parser, String foundTagName)
        {
            if (foundTagName == null)
            {
                return(false);
            }

            if (foundTagName.Equals(ConstInterface.MG_TAG_EVENT))
            {
                var evt = new RunTimeEvent((MgControl)null);
                evt.fillData(parser, null);
                evt.convertParamsToArgs();
                evt.setTask(null);
                evt.setFromServer();
                ClientManager.Instance.EventsManager.addToTail(evt);
            }
            else if (foundTagName.Equals(ConstInterface.MG_TAG_EVENTS_QUEUE))
            {
                parser.setCurrIndex(parser.getXMLdata().IndexOf(XMLConstants.TAG_CLOSE, parser.getCurrIndex()) +
                                    1); // end of outer tag and its ">"
            }
            else if (foundTagName.Equals('/' + ConstInterface.MG_TAG_EVENTS_QUEUE))
            {
                parser.setCurrIndex2EndOfTag();
                return(false);
            }
            else
            {
                Logger.Instance.WriteExceptionToLog("There is no such tag in EventsQueue: " + foundTagName);
                return(false);
            }
            return(true);
        }
Beispiel #4
0
        /// <summary>triggered by gui. enable/disable a given act list.</summary>
        /// <param name = "guiMgCtrl"></param>
        /// <param name = "actList"></param>
        /// <param name = "enable"></param>
        internal void processEnableActs(GuiMgControl guiMgCtrl, int[] actList, bool enable)
        {
            var mgControl = (MgControl)guiMgCtrl;
            var rtEvt     = new RunTimeEvent(mgControl, true);

            rtEvt.setInternal(enable
                              ? InternalInterface.MG_ACT_ENABLE_EVENTS
                              : InternalInterface.MG_ACT_DISABLE_EVENTS);
            rtEvt.setActEnableList(actList);
            ClientManager.Instance.EventsManager.addToTail(rtEvt);
        }
Beispiel #5
0
        /// <summary>process Resize of the page, for table controls only</summary>
        /// <param name = "guiMgCtrl"></param>
        /// <param name = "newRowsInPage"></param>
        internal void processTableResize(GuiMgControl guiMgCtrl, int newRowsInPage)
        {
            var mgControl = (MgControl)guiMgCtrl;

            if (mgControl != null)
            {
                var rtEvt = new RunTimeEvent(mgControl, newRowsInPage, true);
                rtEvt.setInternal(InternalInterface.MG_ACT_RESIZE);
                ClientManager.Instance.EventsManager.addToTail(rtEvt);
            }
        }
Beispiel #6
0
        /// <summary>
        /// If current control becomes invisible/disabled/non parkable, then put MG_ACT_TBL_NXTFLD into queue.
        /// </summary>
        /// <param name="ctrl">control whose property is changed.</param>
        internal void OnNonParkableLastParkedCtrl(GuiMgControl ctrl)
        {
            MgControlBase mgControl = (MgControlBase)ctrl;

            //If task is already in exiting edit state, do not add MG_ACT_TBL_NXTFLD. (Defect 67647)
            if (ClientManager.Instance.EventsManager.getForceExit() != ForceExit.Editing)
            {
                RunTimeEvent rtEvt = new RunTimeEvent((MgControl)mgControl, mgControl.getDisplayLine(false), false);
                rtEvt.setInternal(InternalInterface.MG_ACT_TBL_NXTFLD);

                ClientManager.Instance.EventsManager.addToTail(rtEvt);
            }
        }
Beispiel #7
0
        /// <summary>process set data for row</summary>
        ///<param name = "guiMgCtrl">table control</param>
        /// <param name = "sendAll">if true , always send all records</param>
        internal void processGetRowsData(GuiMgControl guiMgCtrl, int desiredTopIndex, bool sendAll,
                                         LastFocusedVal lastFocusedVal)
        {
            var mgControl = (MgControl)guiMgCtrl;

            if (mgControl != null && mgControl.Type == MgControlType.CTRL_TYPE_TABLE)
            {
                var rtEvt = new RunTimeEvent(mgControl, desiredTopIndex, true);
                rtEvt.setInternal(InternalInterface.MG_ACT_ROW_DATA_CURR_PAGE);
                rtEvt.setSendAll(sendAll);
                rtEvt.LastFocusedVal = lastFocusedVal;
                ClientManager.Instance.EventsManager.addToTail(rtEvt);
            }
        }
Beispiel #8
0
        /// <summary>
        /// This function handles DN control value changed event.
        /// </summary>
        /// <param name="guiMgCtrl">DN control</param>
        /// <param name="line">the line of multi line control</param>
        private void ProcessDNControlValueChangedEvent(GuiMgControl guiMgCtrl, int line)
        {
            Debug.Assert(Misc.IsGuiThread());

            //Get the value of the control i.e value of property specified in PropInterface.PROP_TYPE_DN_CONTROL_VALUE_PROPERTY.
            object ctrlVal = ((MgControl)guiMgCtrl).GetDNControlValue();

            //Put action to update the field with property value.
            var rtEvt = new RunTimeEvent((MgControl)guiMgCtrl, line, true);

            rtEvt.setInternal(InternalInterface.MG_ACT_UPDATE_DN_CONTROL_VALUE);
            rtEvt.DotNetArgs = new object[] { ctrlVal };
            ClientManager.Instance.EventsManager.addToTail(rtEvt);
        }
Beispiel #9
0
        /// <summary>process "selection" event</summary>
        /// <param name = "val">the value of the control </param>
        /// <param name = "guiMgCtrl">the control </param>
        /// <param name = "line"> the line of the multiline control </param>
        /// <param name = "produceClick">TODO </param>
        internal void processSelection(String val, GuiMgControl guiMgCtrl, int line, bool produceClick)
        {
            var mgControl = (MgControl)guiMgCtrl;

            if (mgControl.Type == MgControlType.CTRL_TYPE_BUTTON && mgControl.getForm().getTask().getLastParkedCtrl() != mgControl)
            {
                produceClick = true;
            }

            var rtEvt = new RunTimeEvent(mgControl, line, true);

            rtEvt.setInternal(InternalInterface.MG_ACT_SELECTION);
            rtEvt.setValue(val);
            rtEvt.setProduceClick(produceClick);
            ClientManager.Instance.EventsManager.addToTail(rtEvt);
        }
Beispiel #10
0
        /// <summary>process "click" event</summary>
        ///<param name = "guiMgCtrl">the control</param>
        /// <param name = "line"> the line of the multiline control</param>
        /// <param name = "value">the value of the control</param>
        internal void processMouseUp(GuiMgControl guiMgCtrl, int line)
        {
            var  mgControl    = (MgControl)guiMgCtrl;
            var  rtEvt        = new RunTimeEvent(mgControl, line, true);
            bool produceClick = true;

            if (mgControl.Type == MgControlType.CTRL_TYPE_BUTTON &&
                ((CtrlButtonTypeGui)mgControl.getProp(PropInterface.PROP_TYPE_BUTTON_STYLE).getValueInt()) ==
                CtrlButtonTypeGui.Hypertext)
            {
                produceClick = false;
            }
            rtEvt.setProduceClick(produceClick);
            rtEvt.setInternal(InternalInterface.MG_ACT_CTRL_MOUSEUP);
            ClientManager.Instance.EventsManager.addToTail(rtEvt);
        }
Beispiel #11
0
        /// <summary>process browser events</summary>
        /// <param name = "guiMgCtrl">browser control</param>
        /// <param name = "evt">the event code from InternalInterface</param>
        /// <param name = "text">the text of the event</param>
        internal void processBrowserEvent(GuiMgControl guiMgCtrl, int evt, String text)
        {
            var browserCtrl = (MgControl)guiMgCtrl;
            var rtEvt       = new RunTimeEvent(browserCtrl, browserCtrl.getDisplayLine(false), true);

            rtEvt.setInternal(evt);

            var argsList = new GuiExpressionEvaluator.ExpVal[1];
            //create the string for the blob
            string blobString = BlobType.createFromString(text, BlobType.CONTENT_TYPE_UNICODE);

            argsList[0] = new GuiExpressionEvaluator.ExpVal(StorageAttribute.BLOB, false, blobString);
            var args = new ArgumentsList(argsList);

            rtEvt.setArgList(args);

            ClientManager.Instance.EventsManager.addToTail(rtEvt);
        }
Beispiel #12
0
        /// <summary> Add Open Context Menu event on right click on form.</summary>
        /// <param name = "guiMgControl">control </param>
        /// <param name = "guiMgForm">code of internal event </param>
        /// <param name = "left">code of internal event </param>
        /// <param name = "top">code of internal event </param>
        /// <param name = "line">code of internal event </param>
        public void AddOpenContextMenuEvent(GuiMgControl guiMgControl, GuiMgForm guiMgForm, int left, int top, int line)
        {
            MgControl ctrl = null;
            Task      task = null;

            if (guiMgControl != null)
            {
                if (guiMgControl is MgControl)
                {
                    ctrl = (MgControl)guiMgControl;
                    if (ctrl.Type == MgControlType.CTRL_TYPE_SUBFORM)
                    {
                        task = (Task)ctrl.GetSubformMgForm().getTask();
                    }
                    else
                    {
                        task = (Task)((MgControlBase)guiMgControl).getForm().getTask();
                    }
                }
            }
            else
            {
                task = (Task)((MgFormBase)guiMgForm).getTask();
            }

            // Prepare event for MG_ACT_CONTEXT_MENU to open context menu.
            var rtEvt = new RunTimeEvent(task);

            rtEvt.setInternal(InternalInterface.MG_ACT_CONTEXT_MENU);

            rtEvt.setCtrl(ctrl);
            //Prepare an argument list for left and top co-ordinate.
            var argsList = new GuiExpressionEvaluator.ExpVal[3];

            argsList[0] = new GuiExpressionEvaluator.ExpVal(StorageAttribute.ALPHA, false, left.ToString());
            argsList[1] = new GuiExpressionEvaluator.ExpVal(StorageAttribute.ALPHA, false, top.ToString());
            argsList[2] = new GuiExpressionEvaluator.ExpVal(StorageAttribute.ALPHA, false, line.ToString());
            var args = new ArgumentsList(argsList);

            rtEvt.setArgList(args);

            ClientManager.Instance.EventsManager.addToTail(rtEvt);
        }
Beispiel #13
0
 /// <summary>process a dot net event.</summary>
 /// <param name="sender">the object from which the event was raised.</param>
 /// <param name="mgControl">an (optional) control for which the variable was selected.
 /// if null, the invoked object is not a control on a form.</param>
 /// <param name="eventName"></param>
 /// <param name="parameters">parameters passed to the event handler.</param>
 internal void ProcessDotNetEvent(Object sender, GuiMgControl mgControl, String eventName, object[] parameters)
 {
     if (mgControl != null)
     {
         var rtEvt = new RunTimeEvent((MgControl)mgControl, 0, true);
         rtEvt.setDotNet(eventName);
         rtEvt.DotNetArgs = parameters;
         ClientManager.Instance.EventsManager.addToTail(rtEvt);
     }
     else //.net events on objects that are not controls and not connected to any task
     {
         //QCR #926669 , For sibling tasks, events order will be random. But when there is hierarchy, the lower task in the subtask tree should be performed first.
         List <Task> tasks = ClientManager.Instance.getTasksByObject(sender);
         tasks.Sort(ClientManager.CompareByDepth);
         foreach (Task item in tasks)
         {
             var rtEvt = new RunTimeEvent(item, true);
             rtEvt.setDotNet(eventName);
             rtEvt.DotNetObject = sender;
             rtEvt.DotNetArgs   = parameters;
             ClientManager.Instance.EventsManager.addToTail(rtEvt);
         }
     }
 }
Beispiel #14
0
 /// <summary>
 /// check if event can be executed during task close
 /// </summary>
 /// <param name="evt"></param>
 /// <returns></returns>
 internal virtual bool AllowEventExecutionDuringTaskClose(RunTimeEvent evt)
 {
     return(false);
 }