Пример #1
0
 /// <summary>
 ///  close the task, if the wide is open, then close is before close the task
 /// </summary>
 /// <param name = "form"> </param>
 internal void abort(MgForm form)
 {
     if (form != null)
     {
         Task mainProg = MGDataCollection.Instance.GetMainProgByCtlIdx(form.getTask().getCtlIdx());
         Manager.Abort(form, mainProg);
     }
 }
Пример #2
0
        /// <summary>
        ///   Set the current cursor
        /// </summary>
        /// <param name = "shape">code of mouse cursor: "wait", "hand"...</param>
        internal bool setCurrentCursor(MgCursors shape)
        {
            bool ret = true;

            if (Manager.IsInitialized() && !ClientManager.Instance.IsHidden)
            // !ClientManager.isHidden: Topic #13 (MAGIC version 1.8\SP1 for WIN) RC mobile - improve performance: spec, section 4.3
            {
                Commands.addAsync(CommandType.SET_CURRENT_CURSOR, shape);
                Commands.beginInvoke();
            }
            return(ret);
        }
Пример #3
0
        /// <summary>
        ///   fill the file mapping when passed through the cache: placed into the cache by the runtime-engine, passed
        ///   as '<fileurl val = "/..."'
        /// </summary>
        /// <param name = "TAG_URL"></param>
        internal void fillFromUrl(String tagName)
        {
            XmlParser parser  = ClientManager.Instance.RuntimeCtx.Parser;
            String    XMLdata = parser.getXMLdata();

            int endContext = parser.getXMLdata().IndexOf(XMLConstants.TAG_TERM, parser.getCurrIndex());

            if (endContext != -1 && endContext < XMLdata.Length)
            {
                // find last position of its tag
                String tagAndAttributes = parser.getXMLsubstring(endContext);
                parser.add2CurrIndex(tagAndAttributes.IndexOf(tagName) + tagName.Length);

                List <String> tokensVector = XmlParser.getTokens(parser.getXMLsubstring(endContext), XMLConstants.XML_ATTR_DELIM);
                Debug.Assert((tokensVector[0]).Equals(XMLConstants.MG_ATTR_VALUE));
                String cachedFileUrl = (tokensVector[1]);

                if (cachedFileUrl.Trim() == "") // might happen in case the xpa server failed to write to its cache folder (e.g. the cache folder is invalid, due to a configuration mistake, in which case the current error message will be matched with an error in the xpa server's log file (GeneralErrorLog=)).
                {
                    Logger.Instance.WriteErrorToLog(string.Format("Empty cached file URL: '{0}'", tagAndAttributes.Trim()));
                }
                else
                {
                    // environment params are not metadata - they're a reflection of the server's environment params, and shouldn't be handled as a source (specifically shouldn't be collected and be accessed to the server upon switching from session stats local to remote).
                    byte[] Content = (tagName != ConstInterface.MG_TAG_ENV_PARAM_URL
                                    ? ApplicationSourcesManager.GetInstance().ReadSource(cachedFileUrl, true)
                                    : CommandsProcessorManager.GetContent(cachedFileUrl, true));
                    try
                    {
                        switch (tagName)
                        {
                        case ConstInterface.MG_TAG_COLORTABLE_URL:
                            Manager.GetColorsTable().FillFrom(Content);
                            break;

                        case ConstInterface.MG_TAG_FONTTABLE_URL:
                            Manager.GetFontsTable().FillFrom(Content);
                            break;

                        case ConstInterface.MG_TAG_KBDMAP_URL:
                            ClientManager.Instance.getKbdMap().fillKbdMapTable(Content);
                            break;

                        case ConstInterface.MG_TAG_ENV_PARAM_URL:
                            //TODO: MerlinRT :We should parse Environment Table using MgSAXParser instead of XMLParser (the same way like we do for
                            //Font, Color and KeyBoardMappping Table). If we do this for env, then we will have to do it for globalParamChanges as well.
                            XmlParser innerXmlParser = new XmlParser(Encoding.UTF8.GetString(Content, 0, Content.Length));
                            while (ClientManager.Instance.getEnvParamsTable().mirrorFromXML(innerXmlParser.getNextTag(), innerXmlParser))
                            {
                            }
                            break;
                        }
                    }
                    catch (SystemException ex)
                    {
                        switch (tagName)
                        {
                        case ConstInterface.MG_TAG_COLORTABLE_URL:
                            Logger.Instance.WriteExceptionToLog(string.Format("Colors Table: '{0}'{1}{2}", cachedFileUrl, OSEnvironment.EolSeq, ex.Message));
                            break;

                        case ConstInterface.MG_TAG_FONTTABLE_URL:
                            Logger.Instance.WriteExceptionToLog(string.Format("Fonts Table: '{0}'{1}{2}", cachedFileUrl, OSEnvironment.EolSeq, ex.Message));
                            break;

                        case ConstInterface.MG_TAG_KBDMAP_URL:
                            Logger.Instance.WriteExceptionToLog(string.Format("Keyboard Mapping: '{0}'{1}{2}", cachedFileUrl, OSEnvironment.EolSeq, ex.Message));
                            break;
                        }
                    }
                }

                endContext = XMLdata.IndexOf(XMLConstants.TAG_OPEN, endContext);
                if (endContext != -1)
                {
                    parser.setCurrIndex(endContext);
                }
            }
        }