Beispiel #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            SaveFileDialog save = new SaveFileDialog();

            save.Title  = "Save File";
            save.Filter = "XML File (*.xml)|*.xml| All Files(*.*)|*.*";

            if (xmlFile == null)
            {
                label7.Text = "No file has been selected. Please select \"New\" or \"Open\" to select a file.";
            }
            else
            {
                if (save.ShowDialog() == DialogResult.OK)
                {
                    filepath = save.FileName;

                    ActionsClass.saveSceneTitle(xmlFile);
                    XmlWriter write = XmlWriter.Create(save.FileName);
                    xmlFile.Save(write);

                    write.Dispose();

                    label1.Text = "Saved";
                }
            }
        }
Beispiel #2
0
 private void button8_Click(object sender, EventArgs e)
 {
     textBox3.Text     = ActionsClass.displaybacDevice(ActionsClass.LoadXML(), "sensor", "devInst");
     textBox4.Text     = ActionsClass.displaybacDevice(ActionsClass.LoadXML(), "sensor", "macAddr");
     checkBox4.Checked = false;
     label2.Text       = "Press Enter to Save";
 }
Beispiel #3
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     xmlFile = ActionsClass.LoadXML();
     ActionsClass.displaySceneList(xmlFile);
     showProperties();
     showCommand();
     enableButton();
 }
Beispiel #4
0
 private void textBox8_Enter(object sender, KeyPressEventArgs e)
 {
     if (xmlFile == null)
     {
         label8.Text = "No file has been selected. Please select \"New\" or \"Open\" to select a file.";
     }
     else
     {
         if (e.KeyChar == (char)Keys.Enter)
         {
             ActionsClass.setScene(3, textBox8.Text);
             checkBox5.Checked = true;
             label6.Text       = "Modified";
         }
     }
 }
Beispiel #5
0
 private void textBox4_Enter(object sender, KeyPressEventArgs e)
 {
     if (xmlFile == null)
     {
         label8.Text = "No file has been selected. Please select \"New\" or \"Open\" to select a file.";
     }
     else
     {
         if (e.KeyChar == (char)Keys.Enter)
         {
             ActionsClass.saveMACAddr(xmlFile, "sensor", textBox3.Text, "macAddr", textBox4.Text);
             checkBox4.Checked = true;
             label2.Text       = "Modified";
         }
     }
 }
Beispiel #6
0
        private void showProperties()
        {
            //Load file path
            label7.Text = ("Loaded " + filepath);
            label8.Text = ("Loaded " + filepath);
            label9.Text = ("Loaded " + filepath);

            textBox1.Text = ActionsClass.displaybacDevice(xmlFile, "pic", "devInst");
            textBox2.Text = ActionsClass.displaybacDevice(xmlFile, "pic", "macAddr");
            textBox3.Text = ActionsClass.displaybacDevice(xmlFile, "sensor", "devInst");
            textBox4.Text = ActionsClass.displaybacDevice(xmlFile, "sensor", "macAddr");


            textBox5.Text = ActionsClass.getScene(0);
            textBox6.Text = ActionsClass.getScene(1);
            textBox7.Text = ActionsClass.getScene(2);
            textBox8.Text = ActionsClass.getScene(3);
        }
Beispiel #7
0
        //Open file
        private void openToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            open.Title  = "Open File";
            open.Filter = "XML File (*.xml)|*.xml| All Files(*.*)|*.*";

            if (open.ShowDialog() == DialogResult.OK)
            {
                filepath = open.FileName;

                StreamReader read = new StreamReader(File.OpenRead(open.FileName));
                xmlFile = ActionsClass.LoadXML(open.FileName);
                ActionsClass.displaySceneList(xmlFile);

                read.Dispose();
                showProperties();
                showCommand();
                enableButton();
            }
        }
Beispiel #8
0
        private void button9_Click(object sender, EventArgs e)
        {
            ActionsClass.displaySceneList(ActionsClass.LoadXML());

            //Scene 1
            textBox5.Text     = ActionsClass.getScene(0);
            checkBox3.Checked = false;
            label3.Text       = "Press Enter to Save";

            //Scene 2
            textBox6.Text     = ActionsClass.getScene(1);
            checkBox1.Checked = false;
            label4.Text       = "Press Enter to Save";

            //Scene 3
            textBox7.Text     = ActionsClass.getScene(2);
            checkBox2.Checked = false;
            label5.Text       = "Press Enter to Save";

            //Scene 4
            textBox8.Text     = ActionsClass.getScene(3);
            checkBox5.Checked = false;
            label6.Text       = "Press Enter to Save";
        }