//Open file
        private void openToolStripMenuItem_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.findDeviceConnected();
                ActionsClass.displaySceneList(xmlFile);
                ActionsClass.setXmlDocument(xmlFile);

                deviceTab.showProperties(xmlFile);
                deviceTab2.showProperties(xmlFile);
                userScenes.showProperties();

                showDisplay();

                read.Dispose();
            }
        }
Exemplo n.º 2
0
        //Save
        private void save_Click(object sender, EventArgs e)
        {
            SaveFileDialog save = new SaveFileDialog();

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

            if (ActionsClass.xmlFile == null)
            {
                cmd.Text = "No file has been selected. Please select \"New\" or \"Open\" to select a file.";
            }
            else
            {
                if (save.ShowDialog() == DialogResult.OK)
                {
                    var settings = new XmlWriterSettings();
                    settings.OmitXmlDeclaration = true;
                    settings.Indent             = true;
                    filepath = save.FileName;

                    XmlWriter write = XmlWriter.Create(save.FileName, settings);
                    ActionsClass.getXmlDocument().Save(write);

                    write.Dispose();

                    macAddress.TextCMD = "Saved";
                    macAddress.Checked = true;

                    deviceInstance.TextCMD = "Saved";
                    deviceInstance.Checked = true;
                }
            }
        }
Exemplo n.º 3
0
 //When user input different DI
 private void Scene_Enter(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Enter)
     {
         ActionsClass.setScene(sceneNumber, stringScene.Text);
         modScene.Checked = true;
         cmd.Text         = "Modified";
     }
 }
Exemplo n.º 4
0
 //When user input different MAC
 public void mac_Enter(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Enter)
     {
         ActionsClass.saveMACAddr(ActionsClass.xmlFile, "pic", macString.Text, "devInst", macString.Text);
         modMAC.Checked = true;
         cmd.Text       = "Modified";
     }
 }
Exemplo n.º 5
0
 public void showProperties(XmlDocument doc)
 {
     if (groupBoxTab.Text.Equals("MVM Gateway"))
     {
         deviceInstance.Text = ActionsClass.displaybacDevice(doc, "pic", "devInst");
         macAddress.Text     = ActionsClass.displaybacDevice(doc, "pic", "macAddr");
     }
     else if (groupBoxTab.Text.IndexOf("Sensor", StringComparison.OrdinalIgnoreCase) >= 0)
     {
         deviceInstance.Text = ActionsClass.displaybacDevice(doc, "sensor", "devInst");
         macAddress.Text     = ActionsClass.displaybacDevice(doc, "sensor", "macAddr");
     }
 }
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            xmlFile = ActionsClass.LoadXML();
            ActionsClass.findDeviceConnected();
            ActionsClass.displaySceneList(xmlFile);
            ActionsClass.setXmlDocument(xmlFile);

            //Load file path
            deviceTab.cmdLine = ("Loaded " + filepath);
            deviceTab.showDefaultProperties();
            deviceTab2.showDefaultProperties();
            userScenes.showDefaultProperties();

            showDisplay();
        }
Exemplo n.º 7
0
 public void getdefaultScene(int index)
 {
     stringScene.Text = ActionsClass.getdefaultScene(index);
     cmd.Text         = "Press Enter to Save";
 }