// The Event Handler for the timer // At every interval, add the interval time to the logTimer and record data into the log // If the logTimer is greater than 10 seconds, then stop the timer and close the log private static void OnTimerEvent(object sender, System.EventArgs e) { logTimer += interval; log.writeToLog("Memory Usage: " + pc.NextValue() + "% " + DateTime.Now.ToString()); if (logTimer > 10000) { timer.Stop(); timer.Dispose(); MessageBox.Show("Log Complete"); log.closeLog(); } }