/// <summary> /// Executes a single tick statement in a second thread. /// </summary> public void RunTicker() { try { // Execute the tick if (TickEvent != null) { // Create the arguments TickArgs args = new TickArgs(); args.Skipped = processSkipped; long now = DateTime.Now.Ticks; args.LastTick = now - lastTick; lastTick = now; // Trigger the ticker try { TickEvent(args); } catch (Exception e) { Error("Cannot run ticker tick: " + e); } } // Clear the flag. This is in a locked block because the testing // of it is also in the same lock. lock (this) processing = false; } catch (Exception e) { Error("Error in the RunTicker thread: " + e); } }
/// <summary> /// Enables the guage to be added directly to a tick manager. /// </summary> public void OnTick(TickArgs args) { Activate(); }