Ejemplo n.º 1
0
        static public void SerializeToXML(PCBSettings aParamList, String aFileName)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(PCBSettings));
            TextWriter    textWriter = new StreamWriter(aFileName);

            serializer.Serialize(textWriter, aParamList);
            textWriter.Close();
        }
Ejemplo n.º 2
0
        private void saveFileDialog1_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
        {
            // Get m_PcbFileDescription name.
            string name = saveFileDialog1.FileName;

            PCBSettings pcb = new PCBSettings();

            SaveParams(pcb);

            XMLInterface.SerializeToXML(pcb, name);
        }
Ejemplo n.º 3
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Get the XML settings file
            DialogResult result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK) // Test result.
            {
                string file = openFileDialog1.FileName;
                try
                {
                    PCBSettings pcb = XMLInterface.DeserializeFromXML(file);
                    OpenParams(pcb);
                }
                catch (IOException)
                {
                    MessageBox.Show("Invalid PCB Documenter file");
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Saves form control settings in preparation to saving to an XML file
 /// </summary>
 /// <param name="aPCB">object where form control settings are stored</param>
 private void SaveParams(PCBSettings aPCB)
 {
     aPCB.PCBThickness       = cBoxPCBThickness.Text;
     aPCB.dimX               = txtX.Text;
     aPCB.dimY               = txtY.Text;
     aPCB.inputFolder        = txtInputDirectory.Text;
     aPCB.layerCount         = cBoxLayers.Text;
     aPCB.name               = dropBoxName.Text;
     aPCB.outputFolder       = m_OutputDirectory;
     aPCB.pcbEnabled         = cBoxPCB.Checked.ToString();;
     aPCB.pcbPartNumber      = txtPCBPartNumber.Text;
     aPCB.pcbRevision        = txtPCBRevision.Text;
     aPCB.pcbTitle           = txtPCBTitle.Text;
     aPCB.assemblyEnabled    = cBoxAssembly.Checked.ToString();
     aPCB.assemblyPartNumber = txtAssemblyPartNumber.Text;
     aPCB.assemblyRevision   = txtAssemblyRevision.Text;
     aPCB.assemblyTitle      = txtAssemblyTitle.Text;
     aPCB.phoneCell          = txtPhoneCell.Text;
     aPCB.phoneOffice        = txtPhoneOffice.Text;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Updates all the controls from data from an XML file
        /// </summary>
        /// <param name="aPCB">XML file data</param>
        private void OpenParams(PCBSettings aPCB)
        {
            cBoxPCBThickness.Text      = aPCB.PCBThickness;
            txtX.Text                  = aPCB.dimX;
            txtY.Text                  = aPCB.dimY;
            txtInputDirectory.Text     = aPCB.inputFolder;
            cBoxLayers.Text            = aPCB.layerCount;
            dropBoxName.Text           = aPCB.name;
            m_OutputDirectory          = aPCB.outputFolder;
            txtPCBPartNumber.Text      = aPCB.pcbPartNumber;
            txtPCBRevision.Text        = aPCB.pcbRevision;
            txtPCBTitle.Text           = aPCB.pcbTitle;
            txtAssemblyPartNumber.Text = aPCB.assemblyPartNumber;
            txtAssemblyRevision.Text   = aPCB.assemblyRevision;
            txtAssemblyTitle.Text      = aPCB.assemblyTitle;
            txtPhoneCell.Text          = aPCB.phoneCell;
            txtPhoneOffice.Text        = aPCB.phoneOffice;

            if (aPCB.pcbEnabled == "True")
            {
                cBoxPCB.Checked = true;
            }
            else
            {
                cBoxPCB.Checked = false;
            }

            if (aPCB.assemblyEnabled == "True")
            {
                cBoxAssembly.Checked = true;
            }
            else
            {
                cBoxAssembly.Checked = false;
            }
        }