0
I’m making a module that works with file exchange and the documentation asks to wait 20 seconds for the status file xxxxxxxx.However, I do not know how to implement this in C#. I was trying something on that line, but it turns asynchronously, so I can’t get the result bool if the file exists or not at the time I want:
public void ValidarArquivoStatus(int numeroSequencialDoArquivo)
{
seq = numeroSequencialDoArquivo;
aTimer = new Timer(1000);
aTimer.Elapsed += OnTimedEvent;
aTimer.AutoReset = true;
aTimer.Enabled = true;
}
private static void OnTimedEvent(Object source, ElapsedEventArgs e)
{
Principal.ValidouArquivoDeStatus = false;
previousTime = e.SignalTime;
//int tempoMaximoTentativaExecucao = Convert.ToInt32(Funcoes.LeParametro(14, "7", false));
int tempoMaximoTentativaExecucao = 20;
if (ExisteArquivoDeStatus(seq))
{
//aTimer.Enabled = false;
Principal.ValidouArquivoDeStatus = true;
aTimer.Enabled = false;
}
nEventsFired++;
if ((nEventsFired == tempoMaximoTentativaExecucao) || (Principal.ValidouArquivoDeStatus == true))
{
aTimer.Enabled = false;
}
}
What is the signature of the method to which you perform the verification?
– João Paulo Massa