Esempio n. 1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                newLayerSettings = new JobMediaModes();
                for (int i = 0; i < cbxPrintMode.Items.Count; i++)
                {
                    if (cbxPrintMode.GetItemChecked(i))
                    {
                        newLayerSettings.Items.Add((JobMediaMode)cbxPrintMode.Items[i]);
                    }
                }

                var    doc = new SelfcheckXmlDocument();
                string xml = string.Empty;
                xml += PubFunc.SystemConvertToXml(newLayerSettings, typeof(JobMediaModes));

                doc.InnerXml = xml;
                doc.Save(fileName);

                MessageBox.Show("Export print mode successfully!");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Export JobConfig Error:" + ex.Message);
            }
        }
Esempio n. 2
0
        public bool SaveListToXML()
        {
            string fileName = Application.StartupPath + Path.DirectorySeparatorChar + m_JobListFile;

            SelfcheckXmlDocument doc = new SelfcheckXmlDocument();
            bool success             = true;

            try
            {
                XmlElement root = doc.CreateElement("PreviewForlderList");
                for (int i = 0; i < m_PreviewList.Count; i++)
                {
                    XmlNode Pforlder = doc.CreateElement("PreviewForlder");
                    Pforlder.Attributes.Append(doc.CreateAttribute("JobForlderPath")).Value     = ((previewForlderStruct)m_PreviewList[i]).JobForlderPath;
                    Pforlder.Attributes.Append(doc.CreateAttribute("PreviewForlderName")).Value = ((previewForlderStruct)m_PreviewList[i]).PreviewForlderName;
                    root.AppendChild(Pforlder);
                }
                doc.AppendChild(root);
                doc.Save(fileName);
            }
            catch (Exception e)
            {
                success = false;

                Debug.Assert(false, e.Message + e.StackTrace);
            }

            return(success);
        }
Esempio n. 3
0
        /// <summary>
        /// The save tool strip button_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void saveToolStripButton_Click(object sender, EventArgs e)
        {
            string         fileName = string.Empty;
            SaveFileDialog sfd      = new SaveFileDialog();

            sfd.Filter   = "Setting Files (*.xml)|*.xml";
            sfd.FileName = Application.StartupPath;
            DialogResult dr = sfd.ShowDialog();

            if (dr == DialogResult.OK)
            {
                fileName = sfd.FileName;
            }
            else
            {
                return;
            }

            SelfcheckXmlDocument doc = new SelfcheckXmlDocument();

            try
            {
                XmlElement root = doc.CreateElement("MICP");
                doc.AppendChild(root);
                string xml = string.Empty;

                // adParamT_Epson2HeadV1
                xml += this.ToXML();

                root.InnerXml = xml;
                doc.Save(fileName);
            }
            catch (Exception ex)
            {
                Debug.Assert(false, ex.Message + ex.StackTrace);
            }
        }
Esempio n. 4
0
        private void SaveCameraBindXml()
        {
            string path = Path.Combine(Application.StartupPath, "camera_bind.xml");
            SelfcheckXmlDocument doc = new SelfcheckXmlDocument();

            if (File.Exists(path))
            {
                doc.Load(path);
                XmlNodeList nodes = doc.SelectNodes("//Camera/_");
                for (int i = 0; i < nodes.Count; i++)
                {
                    var selectSingleNode = nodes[i].SelectSingleNode("Name");
                    if (selectSingleNode != null && selectSingleNode.InnerText == "LeftCamera")
                    {
                        var ip = nodes[i].SelectSingleNode("IPAddress");
                        ip.InnerText = "\"" + comboBoxLeftIp.SelectedItem.ToString() + "\"";
                    }
                    if (selectSingleNode != null && selectSingleNode.InnerText == "RightCamera")
                    {
                        var ip = nodes[i].SelectSingleNode("IPAddress");
                        ip.InnerText = "\"" + comboBoxRightIp.SelectedItem.ToString() + "\"";
                    }
                }
            }
            else
            {
                XmlDeclaration declaration = doc.CreateXmlDeclaration("1.0", "", "");
                doc.AppendChild(declaration);
                XmlElement root            = doc.CreateElement("opencv_storage");
                XmlNode    calibrationData = doc.CreateElement("calibrationData");
                calibrationData.InnerText = DateTime.Now.ToLongDateString();
                root.AppendChild(calibrationData);
                XmlNode camera = doc.CreateElement("Camera");
                root.AppendChild(camera);

                XmlNode left     = doc.CreateElement("_");
                XmlNode leftName = doc.CreateElement("Name");
                leftName.InnerText = "LeftCamera";
                left.AppendChild(leftName);
                XmlNode leftIpAddress = doc.CreateElement("IPAddress");
                leftIpAddress.InnerText = comboBoxLeftIp.SelectedItem.ToString();
                left.AppendChild(leftIpAddress);
                camera.AppendChild(left);

                XmlNode right     = doc.CreateElement("_");
                XmlNode rightName = doc.CreateElement("Name");
                rightName.InnerText = "RightCamera";
                right.AppendChild(rightName);
                XmlNode rightIpAddress = doc.CreateElement("IPAddress");
                rightIpAddress.InnerText = comboBoxRightIp.SelectedItem.ToString();
                right.AppendChild(rightIpAddress);
                camera.AppendChild(right);

                doc.AppendChild(root);
                doc.Save(path);
                XmlNodeList nodes = doc.SelectNodes("//Camera/_");
                for (int i = 0; i < nodes.Count; i++)
                {
                    var selectSingleNode = nodes[i].SelectSingleNode("Name");
                    if (selectSingleNode != null && selectSingleNode.InnerText == "LeftCamera")
                    {
                        var ip = nodes[i].SelectSingleNode("IPAddress");
                        ip.InnerText = "\"" + comboBoxLeftIp.SelectedItem.ToString() + "\"";
                    }
                    if (selectSingleNode != null && selectSingleNode.InnerText == "RightCamera")
                    {
                        var ip = nodes[i].SelectSingleNode("IPAddress");
                        ip.InnerText = "\"" + comboBoxRightIp.SelectedItem.ToString() + "\"";
                    }
                }
            }
            doc.Save(path);
        }