示例#1
0
 // Открыть главное окно
 void showReportMainFrame()
 {
     // Проверка файла-шаблона
     if (!File.Exists(assemblyFolder + StringResource.xmlPathToolsParams))
     {
         logger.Info("Создание файла шаблона параметров инструмента");
         AdditionalToolParameters.creatPatternFile(assemblyFolder + StringResource.xmlPathToolsParams);
     }
     mainFrame = new MainFrame();
     mainFrame.ShowDialog();
 }
示例#2
0
        //----------------------------------------------------------------------------------------
        private void loadPatternParameterFile(GostTool[] toolsArray)
        {
            if (!File.Exists(Connect.assemblyFolder + StringResource.xmlPathPattrenFileName))
            {
                AdditionalToolParameters.creatPatternFile(Connect.assemblyFolder + StringResource.xmlPathPattrenFileName);
                return;
            }

            XmlDocument XmlDoc = new XmlDocument();

            XmlDoc.Load(Connect.assemblyFolder + StringResource.xmlPathPattrenFileName);
            // get root element
            XmlElement xmlRoot = XmlDoc.DocumentElement;
            // select all tools
            XmlNodeList allToolsList = xmlRoot.SelectNodes(StringResource.xmlElementName);
            int         index        = 0;

            foreach (XmlNode nodeTool in allToolsList)
            {
                XmlNode singleNodeName = nodeTool.SelectSingleNode("@" + StringResource.xmlToolName);
                string  sToolName      = singleNodeName.Value;
                if (String.Equals(sToolName, toolsArray[index].toolName))
                {
                    XmlNodeList parametersList = nodeTool.ChildNodes;
                    for (int i = 0; i < parametersList.Count; i++)
                    {
                        ToolParameter newParam = new ToolParameter();
                        newParam.Name    = parametersList[i].SelectSingleNode("@" + StringResource.xmlParameterName).Value;
                        newParam.Capture = parametersList[i].SelectSingleNode("@" + StringResource.xmlParameterCapture).Value;
                        newParam.Type    = parametersList[i].SelectSingleNode("@" + StringResource.xmlParameterType).Value;
                        newParam.CLCode  = int.Parse(parametersList[i].SelectSingleNode("@" + StringResource.xmlParameterClCode).Value);

                        AdditionalToolParameters.gostToolsArray[index].addParameter(newParam);
                    }
                }
                index++;
            }
        }