Пример #1
0
 private void btnImport_Click(object sender, EventArgs e)
 {
     if (ofdImport.ShowDialog(this) == DialogResult.OK)
     {
         ImportExport  ie       = new ImportExport();
         string        filename = ofdImport.FileName;
         StreamReader  sr       = new StreamReader(filename);
         XmlSerializer s        = new XmlSerializer(typeof(ImportExport));
         ie      = (ImportExport)s.Deserialize(sr);
         this.al = ie.al;
         this.dc = ie.dc;
         i       = 0;
     }
 }
Пример #2
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            if (sfdExport.ShowDialog(this) == DialogResult.OK)
            {
                ImportExport ie = new ImportExport();
                ie.al = this.al;
                ie.dc = this.dc;

                string filename = sfdExport.FileName;
                if (File.Exists(filename))
                {
                    File.Delete(filename);
                }
                StreamWriter  sw = new StreamWriter(filename);
                XmlSerializer s  = new XmlSerializer(typeof(ImportExport));
                s.Serialize(sw, ie);
                sw.Close();
            }
        }