예제 #1
0
        // XML File load
        private void loadXML()
        {
            try
            {
                XmlDocument xmlDoc = new XmlDocument();
                if (File.Exists(constant.JOB_FILE))
                {
                    xmlDoc.Load(constant.JOB_FILE);
                    XmlNodeList jobNodeList = xmlDoc.SelectNodes(constant.XML_START_PATH);

                    for (int i = 0; i < jobNodeList.Count; i++)
                    {
                        XmlNode jobNode = jobNodeList.Item(i);

                        job aJob = new job();
                        for (int j = 0; j < jobNode.ChildNodes.Count; j++)
                        {
                            XmlNode node = jobNode.ChildNodes.Item(j);
                            if (node.Name == constant.XML_TAG_FILENAME)
                            {
                                aJob.setFilename(node.InnerText);
                            }
                            else if (node.Name == constant.XML_TAG_SOURCE)
                            {
                                aJob.setSource(node.InnerText);
                            }
                            else if (node.Name == constant.XML_TAG_DEST)
                            {
                                aJob.setDest(node.InnerText);
                            }
                        }
                        m_jobList.Add(aJob);
                    }
                }
            }
            catch{
                MessageBox.Show("An error has been raised during the XML file reading. Please, be sure the XML File has the good format!", "Oups!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmPath frm = new frmPath();
            frm.ShowDialog(this);

            if (frm.getSourcePath().Length > 0 && frm.getDestPath().Length > 0)
            {
                job aJob = new job();

                aJob.setFilename(frm.getFilename());
                aJob.setSource(frm.getSourcePath());
                aJob.setDest(frm.getDestPath());

                m_jobList.Add(aJob);
            }
            loadList();
            writeXML();
        }