0
I wanted to do a Timespan set, like this from 8:00 to 8:10 and after 16:00 to 16:10 he keeps sending a message that I created, outside of these times is not to appear.
var startTimeSpan = TimeSpan.Zero;
var periodTimeSpan = TimeSpan.FromMinutes(1);
{
var timer = new System.Threading.Timer((e) =>
{
MessageBox.Show("Teste de Mensagem");
},
null, startTimeSpan, periodTimeSpan);
}
Ae I wanted to put this condition on some if.
I think the logic of his programming is right, but he keeps showing the message at any period, not at certain
– Wesley Henrique
@Wesleyhenrique I saw the problem now, it is about my copy and Paste
– HudsonPH
@Wesleyhenrique Try now, i just correct the >= and the time of 16
– HudsonPH
I fixed it and it worked, thanks man
– Wesley Henrique
@Wesleyhenrique marks the answer as accepted, left side checkbox :)
– HudsonPH
Will I be able to implement in an Asp.net system to send an email in that period?
– Wesley Henrique
@Wesleyhenrique yes.
– HudsonPH
And I would have to start it on App_start, with the email configuration?
– Wesley Henrique
in place of msgbox will call the function to do the email sending.
– HudsonPH
That’s what I did, I’ll test to see if it works only on the server and not on every machine the system opens
– Wesley Henrique
On Asp.net does not work.
– Wesley Henrique