private void InitializeInterface()
        {
            string activityName = (string)SimilarActivitiesForm.ConfusingActivities[this.activityIndex];
            this.label1.Text = "During " + activityName + ", how mobile are the following areas of your body?";

            this.sensorLabels = new ArrayList();
            this.sensorButtons = new ArrayList();

            //Initialize Mobility Matrix
            MobilityForm.mobilityMatrix= new int[SimilarActivitiesForm.ConfusingActivities.Count][];
           // this.mobilityIndex = new int[SimilarActivitiesForm.ConfusingActivities.Count][];
            SXML.Reader sreader = new SXML.Reader(Constants.MASTER_DIRECTORY, TroubleshootModel.SelectedFolder);
            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(Constants.MAX_CONTROLLERS);
            }

            for (int i = 0; (i < MobilityForm.mobilityMatrix.Length); i++)
            {
                MobilityForm.mobilityMatrix[i] = new int[this.sensors.Sensors.Count];
                //this.mobilityIndex[i] = new int[this.sensors.Sensors.Count];
                for (int j = 0; (j < this.sensors.Sensors.Count); j++)
                {
                    MobilityForm.mobilityMatrix[i][j] = 0;
                    //this.mobilityIndex[i][j] = 0;
                }
            }

            int index = 0;
            foreach (SXML.Sensor sensor in this.sensors.Sensors)
            {

                System.Windows.Forms.Label label = new System.Windows.Forms.Label();
                label.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold);
                label.Location = new System.Drawing.Point(16, 97+ (30 * index));
                label.Name = Convert.ToString(index);
                label.Size = new System.Drawing.Size(56, 19);
                label.Text = sensor.Location;
                this.Controls.Add(label);
                this.sensorLabels.Add(label);

                System.Windows.Forms.Button button = new System.Windows.Forms.Button();
                button.Location = new System.Drawing.Point(78, 87 + (30 * index));
                button.Name = Convert.ToString(index);
                button.Size = new System.Drawing.Size(120, 30);
                button.TabIndex = index;
                button.Text = Constants.MOBILITY_FORM_NOT_MOBILE_LABEL;
                button.Click += new System.EventHandler(this.button_Click);
                this.Controls.Add(button);
                this.sensorButtons.Add(button);
                index++;
            }

            this.button2.Location = new System.Drawing.Point(78, 87 + (30 * index));
            this.button3.Location = new System.Drawing.Point(16, 87 + (30 * index));
        }
        private void InitializeInterface()
        {
            
            orientationMatrix = new int[SimilarActivitiesForm.ConfusingActivities.Count][];
            //orientationIndex = new int[SimilarActivitiesForm.ConfusingActivities.Count][];
            SXML.Reader sreader = new SXML.Reader(Constants.MASTER_DIRECTORY, TroubleshootModel.SelectedFolder);
            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(Constants.MAX_CONTROLLERS);
            }

            for (int i = 0; (i < OrientationForm.orientationMatrix.Length); i++)
            {
                OrientationForm.orientationMatrix[i] = new int[this.sensors.Sensors.Count];
            //    this.orientationIndex[i] = new int[this.sensors.Sensors.Count];
                for (int j = 0; (j < this.sensors.Sensors.Count); j++)
                {
                    OrientationForm.orientationMatrix[i][j] = -1;
          //          this.orientationIndex[i][j] = 0;
                }
            }


            BodyXML.Parser parser = new BodyXML.Parser(Constants.MASTER_DIRECTORY);
            this.bodyParts = parser.parse();
            this.body_parts=new ArrayList();
            this.body_parts_orientations= new ArrayList();
            this.body_parts_orientations_names= new ArrayList();
            int maxImageWidth = 0;
            int maxImageHeight = 0;
            foreach (BodyPart bodyPart in this.bodyParts.Bodyparts)
            {
                this.body_parts.Add(bodyPart.Label);
                ArrayList orientations= new ArrayList();
                ArrayList names=new ArrayList();
                foreach (BodyXML.Orientation orientation in bodyPart.Orientations){      
                    System.Drawing.Image orientationImage=(System.Drawing.Image) new System.Drawing.Bitmap(Constants.NEEDED_FILES_PATH + "images\\orientations\\"+orientation.Imagefile);
                    if (orientationImage.Width > maxImageWidth)
                        maxImageWidth = orientationImage.Width;
                    if (orientationImage.Height > maxImageHeight)
                        maxImageHeight = orientationImage.Height;

                    orientations.Add(orientationImage);
                    names.Add(orientation.Label);
                }
                this.body_parts_orientations.Add(orientations);
                this.body_parts_orientations_names.Add(names);
            }

            this.bodyPartCurrentIndex = 0;
            this.orientationCurrentIndex = 0;
            this.activityCurrentIndex = 0;
            //this.pictureBox1.Width = maxImageWidth+Constants.WIDGET_SPACING*2;
            //this.pictureBox1.Height = maxImageHeight + Constants.WIDGET_SPACING * 2;
            //this.panel1.Width = this.pictureBox1.Width + Constants.WIDGET_SPACING * 2;
            //this.panel1.Height = this.pictureBox1.Height + Constants.WIDGET_SPACING * 2;
            this.panel1.BackColor = System.Drawing.Color.White;
            //this.button1.Location = new System.Drawing.Point(this.panel1.Location.X, this.panel1.Location.Y + this.panel1.Location.Y);
            //this.button2.Location = new System.Drawing.Point(this.panel1.Location.X, this.panel1.Location.Y + this.button1.Location.Y+this.button1.Width+Constants.WIDGET_SPACING);
            this.pictureBox1.Image = (System.Drawing.Image)((ArrayList)this.body_parts_orientations[this.bodyPartCurrentIndex])[this.orientationCurrentIndex];
            this.label2.Text = (string)((ArrayList)this.body_parts_orientations_names[this.bodyPartCurrentIndex])[this.orientationCurrentIndex];
            this.label1.Text = "During " + (string)SimilarActivitiesForm.ConfusingActivities[activityCurrentIndex] + ", how does your "+(string)this.body_parts[this.bodyPartCurrentIndex]+" look like?";

        }