Improved lots of the timing code in UIThread callbacks.

This commit is contained in:
Lars Brubaker 2014-12-18 18:18:11 -08:00
parent ce2eb042c8
commit 4fcb81d555
4 changed files with 8 additions and 47 deletions

View file

@ -45,7 +45,6 @@ namespace MatterHackers.MatterControl.ActionBar
{
public class PrintStatusRow : FlowLayoutWidget
{
Stopwatch timeSinceLastDrawTime = new Stopwatch();
event EventHandler unregisterEvents;
TextWidget activePrintName;
@ -281,7 +280,6 @@ namespace MatterHackers.MatterControl.ActionBar
public override void OnDraw(Graphics2D graphics2D)
{
timeSinceLastDrawTime.Restart();
base.OnDraw(graphics2D);
}
@ -289,20 +287,12 @@ namespace MatterHackers.MatterControl.ActionBar
{
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
{
if (!timeSinceLastDrawTime.IsRunning)
{
timeSinceLastDrawTime.Start();
}
else if (timeSinceLastDrawTime.ElapsedMilliseconds > 999)
{
UpdatePrintStatus();
timeSinceLastDrawTime.Restart();
}
UpdatePrintStatus();
}
if (!WidgetHasBeenClosed)
{
UiThread.RunOnIdle(OnIdle);
UiThread.RunOnIdle(OnIdle, 1);
}
}