protected override void OnStart(string[] args) { try { eventLog1.WriteEntry("Iniciando o monitoramento das Receitas"); ReceitasThread t = new ReceitasThread(_receitaServices); System.Threading.Thread fwt = new System.Threading.Thread(t.Start); fwt.Start(); eventLog1.WriteEntry("Iniciando o monitoramento do Rabbit"); RabbitmqThread tr = new RabbitmqThread(config); System.Threading.Thread fwt2 = new System.Threading.Thread(tr.Start); fwt2.Start(); eventLog1.WriteEntry("Iniciando o Envio automático das Receitas"); ReceitasAutoThread rat = new ReceitasAutoThread(_receitaServices); System.Threading.Thread fwt3 = new System.Threading.Thread(rat.Start); fwt3.Start(); } catch (Exception ex) { eventLog1.WriteEntry(ex.Message); this.Stop(); } }
static void Mainaa(string[] args) { UnityContainer container = new UnityContainer(); IReceitaService _receitaServices = new ReceitaService(new ReceitasRepository()); RabbitmqConfig config = (RabbitmqConfig)System.Configuration.ConfigurationManager.GetSection("RabbitmqConfig"); //ReceitasThread t = new ReceitasThread(_receitaServices); //System.Threading.Thread fwt = new System.Threading.Thread(t.Start); //fwt.Start(); ReceitasAutoThread rat = new ReceitasAutoThread(_receitaServices); System.Threading.Thread fwt3 = new System.Threading.Thread(rat.Start); fwt3.Start(); while (true) { } }