我正在尝试在我的Windows Store应用程序中设置计时器。
public void Start_timer()
{
Windows.UI.Xaml.DispatcherTimer timer = new DispatcherTimer();
timer.Tick += new Windows.UI.Xaml.EventHandler(timer_Tick);
timer.Interval = new TimeSpan(00, 1, 1);
bool enabled = timer.IsEnabled; // Enable the timer
timer.Start(); // Start the timer
}
当我点击按钮时,我调用上述方法来设置计时器。但是当为Tick事件处理程序设置EventHandler时,出现错误 "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."我们在Windows Store应用程序中需要以不同的方式处理计时器吗?