//LOAD EXPERIMENT BATCH public static void loadExperimentBatch(XmlNodeFunction nodeFunction) { string fileDoc = null; OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Experiment batch | *." + XMLConfig.experimentBatchExtension; ofd.InitialDirectory = Path.Combine(Path.GetDirectoryName(Directory.GetCurrentDirectory()), "experiments"); if (ofd.ShowDialog() == DialogResult.OK) { fileDoc = ofd.FileName; } else return; //LOAD THE EXPERIMENT BATCH IN THE QUEUE XmlDocument batchDoc = new XmlDocument(); batchDoc.Load(fileDoc); XmlElement fileRoot = batchDoc.DocumentElement; if (fileRoot.Name == XMLConfig.batchNodeTag) { foreach (XmlNode experiment in fileRoot.ChildNodes) { if (experiment.Name == XMLConfig.experimentNodeTag) { nodeFunction(experiment); } } } else CaliburnUtility.showWarningDialog("Malformed XML in experiment queue file. No badger node.","ERROR"); return; }
//LOAD EXPERIMENT BATCH static public void loadExperimentBatch(XmlNodeFunction nodeFunction, string batchFilename = "") { if (batchFilename == "") { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Experiment batch | *." + XMLConfig.experimentBatchExtension; ofd.InitialDirectory = Path.Combine(Path.GetDirectoryName(Directory.GetCurrentDirectory()), "experiments"); if (ofd.ShowDialog() == DialogResult.OK) { batchFilename = ofd.FileName; } else { return; } } //LOAD THE EXPERIMENT BATCH IN THE QUEUE XmlDocument batchDoc = new XmlDocument(); batchDoc.Load(batchFilename); XmlElement fileRoot = batchDoc.DocumentElement; if (fileRoot.Name == XMLConfig.batchNodeTag) { foreach (XmlNode experiment in fileRoot.ChildNodes) { if (experiment.Name == XMLConfig.experimentNodeTag) { nodeFunction(experiment); } } } else { CaliburnUtility.showWarningDialog("Malformed XML in experiment queue file. No badger node.", "ERROR"); } return; }