【发布时间】:2015-02-14 21:30:41
【问题描述】:
如何在我的 Windows Phone 8.1 应用中实现倒计时?似乎没有可用的信息。我能找到的所有应用程序都适用于 Windows 窗体应用程序或 Windows 应用程序,但它们似乎都不适用于手机应用程序。这就是我正在做的 -
namespace Timer
{
public partial class MainPage : Page
{
DispatcherTimer mytimer = new DispatcherTimer();
int currentcount = 0;
public MainPage()
{
InitializeComponent();
mytimer = new DispatcherTimer();
mytimer.Interval = new TimeSpan(0, 0, 0, 1, 0);
mytimer.Tick += new EventHandler(mytime_Tick);
//HERE error comes Cannot implicitly convert type System.EventHandler to System.EventHandler<object>
}
private void mytime_Tick(object sender,EventArgs e)
{
timedisplayBlock.Text = currentcount++.ToString();
}
private void startButton_Click(object sender, RoutedEventArgs e)
{
mytimer.Start();
}
}
}
但它给了我这个错误-
Cannot implicitly convert type System.EventHandler to System.EventHandler<object>
【问题讨论】:
-
你能发布你认为可行但没有用的代码吗?也许包括在 Windows 应用程序中工作的屏幕截图?
-
使用超时时间为 1 秒的 DispatcherTimer
-
@AustinMullins 我已经用我的代码和错误编辑了我的问题。
-
@thumbmunkeys 我用过
DispatcherTImer,但它给了我一个错误。
标签: c# visual-studio windows-phone-7 windows-phone-8