public void StartProcess(ProcessWebSocketFacturas handler, string tarea) { Thread.Sleep(1000); for (int i = 0; i < 2; i++) { if (System.Web.HttpContext.Current.Application["APIBRINSA_" + tarea] != null) { var proc = System.Web.HttpContext.Current.Application["APIBRINSA_" + tarea]; System.Web.HttpContext.Current.Application["APIBRINSA_" + tarea] = null; i = 2; DemoEventArgs e = new DemoEventArgs() { Handler = handler, Message = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm") + " => " + tarea + " FACTURAS " + proc.ToString() + "." }; this.OnSendToClient(e); } else { i = 0; DemoEventArgs e = new DemoEventArgs() { Handler = handler, //DateTime.UtcNow.ToString("MM/dd/yyyy HH:mm:ss fffffff") Message = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm") + " => " + tarea + " Procesando FACTURAS..., " }; this.OnSendToClient(e); Thread.Sleep(2000); } } }
protected virtual void OnSendToClient(DemoEventArgs e) { this.SendToClient?.Invoke(this, e); }
private void SendToClientMessage(object sender, DemoEventArgs e) { e.Handler.Send(e.Message); }