Have a variable that collects the clicks (every time user clicks, increase it by one).
Remember interval start time:
long startTime = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
Now you have what you need. If you want to refresh the APM every second, you take current time, subtract startTime and see if 1 second has passed. If it did, return the counter and restart the process.
[1]: http://msdn.microsoft.com/en-us/library/system.datetime.now(v=vs.110).aspx
↧