コード例 #1
0
        private void CreateViews(ApsimFile.Component Comp)
        {
            // ----------------------------------------------------
            // Create a view for the specified component and add
            // it to the list of views that we'll display later.
            // ----------------------------------------------------

            foreach (ApsimFile.Component Child in Comp.ChildNodes)
            {
                CreateViews(Child);
            }

            if (Comp.Type == "GDApsimFileReader")
            {
                // Auto populate the ApsimFileReader with the filenames in the response file.
                string FileReaderContents = "<GDApsimFileReader name=\"ApsimFileReader\">";
                foreach (string FileName in OutputFileNames)
                {
                    FileReaderContents += "<FileName>" + FileName + "</FileName>";
                }

                FileReaderContents += "</GDApsimFileReader>";
                Comp.Contents       = FileReaderContents;
            }
            if (Comp.Type != "Graph")
            {
                if (Comp.Type == "GDApsimFileReader" && OutputFileNames.Count > 0)
                {
                    // No need to put the file reader in the wizard as it already has filenames.
                    return;
                }
                BaseView View = Controller.CreateUI(Comp.Type);
                if (View != null && View.GetType().ToString() != "CSUserInterface.EmptyUI")
                {
                    Views.Add(View);
                    Components.Add(Comp);
                }
            }
        }