コード例 #1
0
        private void PopulateConstants()
        {
            //Clear out all the old stuff because these UI's are reused by other nodes of the same type.
            ConstantsBox.Clear();
            //Fill it in with the new stuff from this node.
            List <string> Lines = new List <string>();

            ApsimFile.Component outputfileComponent = Controller.ApsimData.Find(NodePath).Parent;
            string FileName = ComponentUtility.CalcFileName(outputfileComponent);

            TitleLabel.Text = "(readonly) Title = " + Path.GetFileNameWithoutExtension(FileName);

            XmlNode ConstantsNode = XmlHelper.Find(Data, "constants");

            if ((ConstantsNode != null))
            {
                foreach (XmlNode Constant in XmlHelper.ChildNodes(ConstantsNode, ""))
                {
                    string ConstantName = XmlHelper.Name(Constant);
                    if (ConstantName.ToLower() != "title")
                    {
                        Lines.Add(ConstantName + " = " + Constant.InnerText);
                    }
                }
            }
            ConstantsBox.Lines = Lines.ToArray();
        }