好的,所以我希望能够记录用户花费多长时间使用该应用程序,并且我将从用户按下按钮然后结束计时器的那一刻开始计时饰面。然后显示,任何人都请帮助我!谢谢!
public void timeSpent()
{
DispatcherTimer dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Start();
}
protected void Application_Start(object sender, EventArgs e)
{
Application["timeSpent"] = 0;
}
protected void Session_Start(object sender, EventArgs e)
{
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
}
protected void Application_Error(object sender, EventArgs e)
{
}
protected void Session_End(object sender, EventArgs e)
{
}
protected void Application_End(object sender, EventArgs e)
{
}
我使用global.asax存储它们,我可以把那些代码放在那里吗?谢谢!的