Exemple #1
0
        public static void ImportFromSoils(BaseController Controller)
        {
            OpenFileDialog Dialog = new OpenFileDialog();

            Dialog.Filter           = "Soils files (*.soils)|*.soils|All files (*.*)|*.*";
            Dialog.Title            = "Select 1 or more .soils file(s) to import from";
            Dialog.Multiselect      = true;
            Dialog.RestoreDirectory = true;
            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                foreach (string FileName in Dialog.FileNames)
                {
                    XmlDocument Doc = new XmlDocument();
                    Doc.Load(FileName);
                    APSIMChangeTool.Upgrade(Doc.DocumentElement);
                    Controller.Selection.Add(Doc.DocumentElement.InnerXml);
                }
            }
        }
        public void Open(XmlNode Node)
        {
            APSIMChangeTool.Upgrade(Node);
            this.ReadOnly = false;

            DisabledEventCount++;
            MyRootNode = new Component(this, null);
            MyRootNode.Read(Node);
            MyRootNode.ResolveShortcuts();

            //FactorialNode should be in the first level
            MyFactorNode = null;
            foreach (Component comp in MyRootNode.ChildNodes)
            {
                if (comp.Type.ToLower() == "factorial")
                {
                    MyFactorNode = comp;
                }
            }

            DisabledEventCount--;
            PublishComponentChanged(MyRootNode);
            SetFileName("Untitled");
        }