Exemple #1
0
        public bool ReadWindowConfigFile(String szXMLConfigFileName)
        {
            int iSheetIndex = 0;
            tclsWindowElement clsWinElement;
            bool boSheetFound = true;

            try
            {
                clsXDoc.Load(szXMLConfigFileName);
                XmlNamespaceManager clsXMLNS = new XmlNamespaceManager(clsXDoc.NameTable);
                XmlElement          clsXRoot = clsXDoc.DocumentElement;
                clsXMLNS.AddNamespace("ss", "urn:schemas-microsoft-com:office:spreadsheet");

                while (true == boSheetFound)
                {
                    String      szXPath            = "//ss:Worksheet[" + Convert.ToString(iSheetIndex + 1) + "]//ss:Row";
                    XmlNodeList lstXMLElementNodes = clsXRoot.SelectNodes(szXPath, clsXMLNS);

                    if (1 < lstXMLElementNodes.Count)
                    {
                        foreach (XmlNode clsXMLNode in lstXMLElementNodes)
                        {
                            XmlNodeList   lstXMLElementConfigNodes = clsXMLNode.ChildNodes;
                            List <String> lstNodeString            = new List <String>();

                            foreach (XmlNode clsXMLNodeConfig in lstXMLElementConfigNodes)
                            {
                                lstNodeString.Add(clsXMLNodeConfig.InnerText);
                            }

                            int      iPresentationOptionCount = lstNodeString.Count - 4;
                            String[] aszPresentationOptions   = null;

                            if (0 < iPresentationOptionCount)
                            {
                                aszPresentationOptions = new String[iPresentationOptionCount];

                                for (int iStringIDX = 4; iStringIDX < (4 + iPresentationOptionCount); iStringIDX++)
                                {
                                    aszPresentationOptions[iStringIDX - 4] = lstNodeString[iStringIDX];
                                }
                            }

                            clsWinElement = new tclsWindowElement(lstNodeString[0],
                                                                  Convert.ToInt16(lstNodeString[1]),
                                                                  lstNodeString[2], lstNodeString[3], aszPresentationOptions);

                            malstWindowLists[iSheetIndex].Add(clsWinElement);
                        }
                        iSheetIndex++;
                    }
                    else
                    {
                        boSheetFound = false;
                    }
                }

                for (int iListIDX = 0; iListIDX < ConstantData.GUI.ru8GUI_WINDOWS_MAX; iListIDX++)
                {
                    mailstWindowLists[iListIDX] = malstWindowLists[iListIDX].AsReadOnly();
                }
            }
            catch
            {
            }

            return(true);
        }
Exemple #2
0
        public bool AddMeasure(string measureName, string[] aszPresentationOptions)
        {
            mboSuspendUpdates = true;
            int iMeasureRemoveIDX = 0;
            int iMeasureIDX;

            if (false == MeasureIsActive(measureName))
            {
                if (maclsWindowElement.Length >= 7)
                {
                    MessageBox.Show("Only 6 gauges can be shown, please remove a gauge first");
                    return(false);
                }
            }

            Program.vNotifyProgramEvent(tenProgramEvent.enCommRequestSuspend, 0, null);

            if (false == MeasureIsActive(measureName))
            {
                boAddMeasure(measureName);

                tclsWindowElement clsWindowElement = new tclsWindowElement("measure", -1, measureName, "Hello", aszPresentationOptions);
                Array.Resize(ref maclsWindowElement, maclsWindowElement.Length + 1);

                maclsWindowElement[maclsWindowElement.Length - 1] = clsWindowElement;
            }
            else
            {
                boRemoveMeasure(measureName);

                foreach (tclsWindowElement clsWindowElement in maclsWindowElement)
                {
                    if (clsWindowElement.szA2LName != measureName)
                    {
                        iMeasureRemoveIDX++;
                    }
                    else
                    {
                        break;
                    }
                }

                for (iMeasureIDX = iMeasureRemoveIDX; iMeasureIDX < maclsWindowElement.Length - 1; iMeasureIDX++)
                {
                    maclsWindowElement[iMeasureIDX].iGUILinkIndex          = maclsWindowElement[iMeasureIDX + 1].iGUILinkIndex;
                    maclsWindowElement[iMeasureIDX].szA2LName              = maclsWindowElement[iMeasureIDX + 1].szA2LName;
                    maclsWindowElement[iMeasureIDX].szElementType          = maclsWindowElement[iMeasureIDX + 1].szElementType;
                    maclsWindowElement[iMeasureIDX].szLabel                = maclsWindowElement[iMeasureIDX + 1].szLabel;
                    maclsWindowElement[iMeasureIDX].aszPresentationOptions = maclsWindowElement[iMeasureIDX + 1].aszPresentationOptions;
                }

                Array.Resize(ref maclsWindowElement, maclsWindowElement.Length - 1);
            }

            Program.vNotifyProgramEvent(tenProgramEvent.enCommRequestDDDIReset, 0, null);

            mboSuspendUpdates = false;

            Program.vNotifyProgramEvent(tenProgramEvent.enCommRequestUnSuspend, 0, null);

            CreateGauges(miFormIDX, false);
            ArrangeElementHosts(true);

            return(true);
        }