Example #1
0
        /// <summary>
        ///   This method is activated when a program menu was selected. It performs the needed operations in order to
        ///   translate the selected program menu into the matching operation
        /// </summary>
        /// <param name="contextID">active/target context (irelevant for RC)</param>
        /// <param name="menuEntryProgram">the selected menu \ bar menuEntryProgram object</param>
        /// <param name="activeForm"></param>
        /// <param name="ActivatedFromMDIFrame"></param>
        /// <returns></returns>
        internal static void onProgramMenuSelection(Int64 contextID, MenuEntryProgram menuEntryProgram, MgForm activeForm, bool ActivatedFromMDIFrame)
        {
            Task menuTask = getLastFocusedTask(activeForm);

            ClientManager.Instance.RuntimeCtx.LastClickedMenuUid = menuEntryProgram.menuUid();
            RunTimeEvent programMenuEvt = new RunTimeEvent(menuEntryProgram, menuTask, ActivatedFromMDIFrame);

            ClientManager.Instance.EventsManager.addToTail(programMenuEvt);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="resType"></param>
        /// <returns></returns>
        internal ExpressionEvaluator.ExpVal evaluate(StorageAttribute resType)
        {
            ExpressionEvaluator.ExpVal expVal = null;
            String retVal;
            bool   isNull = false;

            if (computedByClient())
            {
                expVal = ExpressionEvaluator.eval(_expBytes, resType, _task);
            }
            else
            {
                RunTimeEvent rtEvt       = ClientManager.Instance.EventsManager.getLastRtEvent();
                Task         mprgCreator = null;

                if (rtEvt != null)
                {
                    mprgCreator = rtEvt.getMainPrgCreator();
                }

                // create a new command object only when necessary
                if (resType != _prevResType)
                {
                    _cmdToServer = CommandFactory.CreateEvaluateCommand(_task.getTaskTag(), resType, _id, 0, mprgCreator);
                }
                ClientManager.Instance.execRequestWithSubformRecordCycle(_cmdsToServer, _cmdToServer, this, _task);

                if (resType != StorageAttribute.BLOB && resType != StorageAttribute.BLOB_VECTOR)
                {
                    retVal = _resultValue;
                }
                else if (_resultValue != null && _resultValue.Equals(" "))
                {
                    retVal = "";
                }
                else
                {
                    retVal = RecordUtils.byteStreamToString(_resultValue);
                }

                if (retVal == null)
                {
                    isNull = true;
                }
                // If we don't know what result type we got, and want to keep it, as in ExpCalc
                if (resType == StorageAttribute.NONE)
                {
                    resType = _type;
                }

                expVal = new ExpressionEvaluator.ExpVal(resType, isNull, retVal);
            }
            _prevResType = resType;
            return(expVal);
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="contextID">active/target context (irelevant for RC)</param>
        /// <param name="osCommandMenuEntry"></param>
        /// <param name="lastFocusedCtrlTask">
        ///the task of the last focused control. This is required because even if there is no
        ///last focused control, then also we have task and hence expression/function will be executed properly.
        ///Previously task was obtained from the control and when there was no control,task could not be obtained.
        /// </param>
        /// <returns></returns>
        internal static void onOSMenuSelection(Int64 contextID, MenuEntryOSCommand osCommandMenuEntry, MgForm activeForm)
        {
            Task lastFocusedCtrlTask = getLastFocusedTask(activeForm);

            RunTimeEvent osMenuEvent = new RunTimeEvent(osCommandMenuEntry, lastFocusedCtrlTask);

            if (osCommandMenuEntry.Wait)
            {
                ClientManager.Instance.EventsManager.handleEvent(osMenuEvent, false);
            }
            else
            {
                ClientManager.Instance.EventsManager.addToTail(osMenuEvent);
            }
        }
Example #4
0
        /// <summary>
        ///   This method is activated when an Event menu was selected. It performs the needed operations in order to
        ///   translate the selected event menu into the matching operation
        /// </summary>
        /// <param name = "menuEntryEvent">the selected menu \ bar menuEntryEvent object</param>
        /// <param name = "activeForm">last active Form</param>
        /// <param name = "ctlIdx">the index of the ctl which the menu is attached to in toolkit</param>
        internal static void onEventMenuSelection(MenuEntryEvent menuEntryEvent, MgForm activeForm, int ctlIdx)
        {
            MgControl lastFocusedControl = getLastFocusedControl(activeForm);
            Task      task = getLastFocusedTask(activeForm);

            RunTimeEvent aRtEvt = new RunTimeEvent(menuEntryEvent, task, lastFocusedControl, ctlIdx);

            aRtEvt.setPublicName();
            aRtEvt.setMainPrgCreator(null);

            // build the argument list from the mainProgVars
            List <String> mainProgVars = menuEntryEvent.MainProgVars;

            if (mainProgVars != null && mainProgVars.Count > 0)
            {
                ArgumentsList argList = new ArgumentsList();
                argList.fillListByMainProgVars(mainProgVars, task.getCtlIdx());
                aRtEvt.setArgList(argList);
                aRtEvt.setTask(null);
            }

            ClientManager.Instance.EventsManager.addToTail(aRtEvt);
        }
Example #5
0
        /// <summary>
        ///   evaluate the expression and return the result
        /// </summary>
        /// <param name = "resType">is the expected type </param>
        /// <param name = "length">of expected Alpha string </param>
        /// <returns> evaluated value or null if value evaluated to null (by ExpressionEvaluator) </returns>
        internal String evaluate(StorageAttribute resType, int length)
        {
            ExpressionEvaluator.ExpVal expVal = null;
            String retVal = null;

            if (computedByClient())
            {
                expVal = ExpressionEvaluator.eval(_expBytes, resType, _task);

                ConvertExpValForDotNet(expVal);

                if (expVal.IsNull)
                {
                    // even if actual dotnet obj is null, we need to return blobPrefix
                    if (expVal.Attr == StorageAttribute.DOTNET)
                    {
                        retVal = expVal.ToMgVal();
                    }
                    else
                    {
                        retVal = null;
                    }
                }
                else if (resType == StorageAttribute.BLOB_VECTOR && expVal.Attr == StorageAttribute.BLOB)
                {
                    if (VectorType.validateBlobContents(expVal.StrVal))
                    {
                        retVal = expVal.ToMgVal();
                    }
                    else
                    {
                        retVal = null;
                    }
                }
                else if (expVal.Attr == StorageAttribute.BLOB_VECTOR &&
                         resType != StorageAttribute.BLOB_VECTOR && resType != StorageAttribute.BLOB)
                {
                    retVal = null;
                }
                else
                {
                    retVal = expVal.ToMgVal();
                }
            }
            else
            {
                RunTimeEvent rtEvt       = ClientManager.Instance.EventsManager.getLastRtEvent();
                Task         mprgCreator = null;

                if (rtEvt != null)
                {
                    mprgCreator = rtEvt.getMainPrgCreator();
                }

                // create a new command object only when necessary
                if (resType != _prevResType)
                {
                    _cmdToServer = CommandFactory.CreateEvaluateCommand(_task.getTaskTag(), resType, _id, length, mprgCreator);
                }
                ClientManager.Instance.execRequestWithSubformRecordCycle(_cmdsToServer, _cmdToServer, this, _task);

                if (resType != StorageAttribute.BLOB && resType != StorageAttribute.BLOB_VECTOR)
                {
                    retVal = _resultValue;
                }
                else if (_resultValue != null && _resultValue.Equals(" "))
                {
                    retVal = "";
                }
                else
                {
                    retVal = RecordUtils.byteStreamToString(_resultValue);
                }
            }
            _prevResType = resType;
            return(retVal);
        }