private void trySave() { try { SeDes.SaveToXml(strDownloadPath + "\\trainedImages.xml", trainedFaces); } catch (Exception ex) { this.Text = ex.Message + "\n" + ex.StackTrace; } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { string xml = SeDes.ToXml(list); string tempfile = strDownloadPath + "\\list_" + DateTime.Now.Ticks.ToString() + ".xml"; string origfile = strDownloadPath + "\\list.xml"; File.WriteAllText(tempfile, xml); if (File.Exists(origfile)) { File.Delete(origfile); } File.Move(tempfile, origfile); }
private void Form1_Load(object sender, EventArgs e) { _capture = new Capture(1); _capture.SetCaptureProperty(CAP_PROP.CV_CAP_PROP_FPS, 30); _capture.SetCaptureProperty(CAP_PROP.CV_CAP_PROP_FRAME_WIDTH, 1024); _capture.SetCaptureProperty(CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT, 768); timer1.Enabled = true; if (File.Exists(strDownloadPath + "\\trainedImages.xml")) { trainedFaces = SeDes.LoadFromXml(strDownloadPath + "\\trainedImages.xml", trainedFaces) as List <trainedFace>; } ThreadPool.QueueUserWorkItem(fixFaces); }
private void Form1_Load(object sender, EventArgs e) { if (!File.Exists(strDownloadPath + "\\list.xml")) { return; } string xml = File.ReadAllText(strDownloadPath + "\\list.xml"); list = (SeDes.ToObj(xml, list) as List <webcam>); DownTrCams(); foreach (webcam r in list) { r.lat = r.lat.Replace(",", "."); r.lng = r.lng.Replace(",", "."); } dataGridView1.DataSource = list.ToList(); labelCnt.Text = list.Count().ToString(); }