コード例 #1
0
 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);
         }
     }
 }
コード例 #2
0
 protected virtual void OnSendToClient(DemoEventArgs e)
 {
     this.SendToClient?.Invoke(this, e);
 }
コード例 #3
0
 private void SendToClientMessage(object sender, DemoEventArgs e)
 {
     e.Handler.Send(e.Message);
 }