private void Form1_Load(object sender, EventArgs e) { if (!File.Exists(strDownloadPath + "\\coordfiles.xml")) { return; } string xml = File.ReadAllText(strDownloadPath + "\\coordfiles.xml"); cfiles = (SeDes.ToObj(xml, cfiles) as CoordFiles); dataGridView1.DataSource = getFiles(); cfiles.PropertyChanged += (a, b) => { if (this.InvokeRequired) { this.Invoke((MethodInvoker) delegate { dataGridView1.DataSource = getFiles(); }); } else { dataGridView1.DataSource = getFiles(); } }; }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { string xmlser = SeDes.ToXml(cfiles); File.WriteAllText(strDownloadPath + "\\coordfiles.xml", xmlser); }