private void _bgwCarregaXMLS_DoWork(object sender, DoWorkEventArgs e) { try { foreach (var _arquivo in System.IO.Directory.GetFiles(ini.Read("EVENTOS", "GERAL"), "*.xml")) { var _historico = Xml_utils.XMLLe(_arquivo); _historico.Usuario = _usuario; TrataAlarme(_historico); System.IO.File.Delete(_arquivo); } } catch { throw; } }
private void _watcher_Created(object sender, FileSystemEventArgs e) { Historico _historico = null; System.Threading.Thread.Sleep(300); try { _historico = Xml_utils.XMLLe(e.FullPath); _historico.Usuario = _usuario; TrataAlarme(_historico); File.Delete(e.FullPath); } catch (Exception ex) { MessageBox.Show(ex.Message); } }