Exemplo n.º 1
0
        public Protocols parse()
        {
            Protocols protocols = new Protocols();
      
            XmlDocument dom = new XmlDocument();
            dom.Load(this.xmlFile);
            XmlNode xNode = dom.DocumentElement;

            if ((xNode.Name == Constants.PROTOCOLS_ELEMENT) && (xNode.HasChildNodes))
            {
                //Protocol Nodes
                foreach (XmlNode iNode in xNode.ChildNodes)
                {
                   
                    if (iNode.Name == Constants.PROTOCOL_ELEMENT)
                    {
                         
                        Protocol protocol = new Protocol();

                        foreach (XmlNode jNode in iNode.ChildNodes)
                        {
                            if (jNode.Name == Constants.NAME_ELEMENT)
                            {
                                protocol.Name = jNode.InnerXml;
                                if (jNode.InnerXml.Length > protocols.LongestLabel.Length)
                                {
                                    protocols.LongestLabel = jNode.InnerXml;
                                }
                            }
                            else if (jNode.Name == Constants.DESCRIPTION_ELEMENT)
                            {
                                protocol.Description = jNode.InnerXml;
                                if (jNode.InnerXml.Length > protocols.LongestDescription.Length)
                                {
                                    protocols.LongestDescription = jNode.InnerXml;
                                }
                            }
                            else if (jNode.Name == Constants.FILE_ELEMENT)
                            {
                                protocol.FileName = jNode.InnerXml;
                            }
                            
                        }

                        protocols.ActivityProtocols.Add(protocol);
                    }
                }

               
            }
            return protocols ;                            
        }
Exemplo n.º 2
0
        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;

        }
Exemplo n.º 3
0
 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     selectedProtocol = (AXML.Protocol) protocols.ActivityProtocols[this.listBox1.SelectedIndex];
     if (this.button1.Enabled == false)
         this.button1.Enabled = true;
 }