我在WPF写的拍卖应用程序,我不知道如何重启我的DispatcherTimer,
这是Timer的代码。
Timer = new DispatcherTimer();
Timer.Interval = new TimeSpan(0,0,1);
Timer.Tick += Timer_Tick;
void Timer_Tick(object sender, object e)
{
if (time > 1)
{
time--;
timertxt.Text = string.Format("00:0{0}:{1}", time / 60, time % 60);
}
else
{
Timer.Stop();
MessageBox.Show("Auction is off !","Error !",MessageBoxButton.OK,MessageBoxImage.Error);
AuctionIDtxt.Clear();
Productnametxt.Clear();
pricetxt.Clear();
descriptiontxtblock.Clear();
winnerislbl.IsVisible.Equals(true);
winnerislbl.Content = "winner is:" ;
winuserlbl.Content = UserLbl;
}
}