static void Main(string[] args) { //consultaSituacao(); //NewMethod(); //conn = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).ConnectionStrings.ConnectionStrings["TaxAuditCommunity"].ConnectionString; //hostPath = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).AppSettings.Settings["Path"].Value; //TaxAuditCommunity.Factory.FileWatcher.Watcher watcher = // new TaxAuditCommunity.Factory.FileWatcher.Watcher(hostPath, conn); //ThreadStart startWatcher = new ThreadStart(watcher.FileWatcher); //Thread threadWatcher = new Thread(startWatcher); //threadWatcher.Start(); //ThreadStart Begining = new ThreadStart(watcher.Beging); //Thread threadBeginig = new Thread(Begining); //while (true) //{ // //threadBeginig.Start(); // //watcher.Beging(); //} var conn = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None) .ConnectionStrings.ConnectionStrings["TaxAuditCommunity"].ConnectionString; var connProsoft = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None) .ConnectionStrings.ConnectionStrings["Pervasive"].ConnectionString; using (var db = new NFeDbContext(conn)) { IStoreEmpresas store = new StoreEmpresas(db); var teste = store.Syncronization(connProsoft, default(CancellationToken)).Result; } }
private void OnChangedProsoft(object sender, FileSystemEventArgs e) { try { using (var db = new NFeDbContext(conn)) { IStoreEmpresas store = new StoreEmpresas(db); var teste = store.Syncronization(connProsoft, default(CancellationToken)).Result; } } catch (Exception err) { if (eventLog1 != null) { eventLog1.WriteEntry(err.ToString(), EventLogEntryType.Error, 15); } else { Console.WriteLine(err.ToString()); } } }