I have a Silverlight application, which accesses a service in WCF. In this application I have a SaveNoteFiscal () method. This method calls a ValidateNoteFiscal method that checks whether an invoice with the reported number and series already exists. This SaveNoteFiscal method is very large because it performs several routines.
The customer clicked this button several times, and 6 notes with the same number were posted to the system; the scenario was this I believe, because there would be no other way to duplicate these notes if there is validation.
I believe that ASP.NET answers requests in parallel, which makes sense to me because there may be multiple concurrent users and the server needs to attend all at once.
As for my problem in Silverlight, I have already tried to disable the button when it is clicked and enable in the callback return, but it has not worked.
public void Salvar()
{
btnSalvar.IsEnabled = false;
NotaFiscalClient objSvcNotaFiscal = new NotaFiscalClient();
objSvcNotaFiscal.SalvarNotaFiscalAsync(this.objNotaFiscal);
objSvcNotaFiscal.SalvarNotaFiscalCompleted += (s, e) =>
btnSalvar.IsEnabled = true;
};
}