我的程序从现在到下一个更新时间完成了操作。我想向用户显示以下格式的计数器时钟计数:00:00:00然后00:20:00并计数20分钟。
这是操作完成的代码,并且timer1应该启动:
private void DownloadCompletedCallback(object sender, AsyncCompletedEventArgs e)
{
if (e.Cancelled)
{
//... download cancelled...
}
else if (e.Error != null)
{
//... download failed...
Logger.Write("Error: " + e.Error);
}
ActiveDownloadJob adJob = e.UserState as ActiveDownloadJob;
ProgressBar pb = (adJob != null) ? adJob.ProgressBar : null;
lock (_downloadQueue)
{
if (_downloadQueue.Count == 0)
{
if (pb != null)
{
pb.Tag = null;
timer2.Stop();
label8.ForeColor = Color.Green;
label8.Text = "Process Finished";
label7.Visible = true;
Timer3滴答事件如果现在为空,但是我认为我应该在其中进行显示并返回计数器。
设置执行时间,未来20分钟
var rut_at = DateTime.Now().AddMinutes(20);
并每秒绑定或刷新一个称为的变量timeLeft
,该变量定义为
var timeLeft = run_at - DateTime.Now();
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句