public Configurations parse() { Configurations configurations = new Configurations(); XmlDocument dom = new XmlDocument(); dom.Load(this.xmlFile); XmlNode xNode = dom.DocumentElement; if ((xNode.Name == Constants.CONFIGURATIONS_ELEMENT) && (xNode.HasChildNodes)) { //Sensorset nodes foreach (XmlNode iNode in xNode.ChildNodes) { if (iNode.Name == Constants.SENSORSET_ELEMENT) { Configuration configuration = new Configuration(); foreach (XmlNode jNode in iNode.ChildNodes) { if (jNode.Name == Constants.NAME_ELEMENT) { configuration.Name = jNode.InnerXml; if (jNode.InnerXml.Length > configurations.LongestLabel.Length) { configurations.LongestLabel = jNode.InnerXml; } } else if (jNode.Name == Constants.DESCRIPTION_ELEMENT) { configuration.Description = jNode.InnerXml; if (jNode.InnerXml.Length > configurations.LongestDescription.Length) { configurations.LongestDescription = jNode.InnerXml; } } else if (jNode.Name == Constants.FILE_ELEMENT) { configuration.FileName = jNode.InnerXml; } } configurations.SensorConfigurations.Add(configuration); } } } return configurations; }
public AnnotationForm(Protocol activityProtocol,Configuration sensorConfiguration)//string dataDirectory, string sourceDirectory) { InitializeComponent(); //AXML.Reader reader = new AXML.Reader(sourceDirectory, this); //if (reader.validate() == false) //{ // throw new Exception("Error Code 0: XML format error - activities.xml does not match activities.xsd!"); //} //else //{ // this.annotation = reader.parse(); // this.annotation.DataDirectory = dataDirectory; // SXML.Reader sreader = new SXML.Reader(sourceDirectory); // if (sreader.validate() == false) // { // throw new Exception("Error Code 0: XML format error - sensors.xml does not match sensors.xsd!"); // } // else // { // this.sensors = sreader.parse(); // } // MITesFeatures.core.conf.ConfigurationReader creader = new MITesFeatures.core.conf.ConfigurationReader(dataDirectory); // this.configuration = creader.parse(); //} InitializeTimers(); InitializeSound(); InitializeInterface(); isAnnotating = false; }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { selectedConfiguration = (Configuration)configurations.SensorConfigurations[this.listBox1.SelectedIndex]; if (this.button1.Enabled==false) this.button1.Enabled = true; }