I have a registration screen that must be validated by several business rules, when the user submits the submit I wanted to leave a page with a message, for example, "Validating, please wait". I tried doing this with asynchronous delegates, I did a test project just to test if it would work, the logic on the server even worked, it called a method that put a sleep on the thread to symbolize the validation time and called the method that brings the The waiting screen problem is that the screen does not appear despite being called. see the controller code
public delegate int Completo();
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
//chama o metodo trabalhar que simula a espera e coloca a action ValidacaoCompleto para ser executada quando o metodo
//Trabalhar estiver concluído
public void Validacao()
{
Numero n = new Numero();
Completo c = new Completo(n.Trabalhar);
IAsyncResult result = c.BeginInvoke(new AsyncCallback (ValidacaoCompleto), null);
TelaValidacao();
}
//chama a View de espera
public ActionResult TelaValidacao()
{
return View();
}
//esse metodo chama a View de validação concluida, não chamei a View direto no metodo TelaValidacao
//por que o tipo de retorno do metodo que será chamdo pelo delegate assincrono não pode ser Actionresult
public void ValidacaoCompleto(IAsyncResult result)
{
ChamarTelaFinal();
}
//chama a View de validação concluida
public ActionResult ChamarTelaFinal()
{
return View();
}
}