From 091ea32cccdf409d1321d26c1960328c4c521eba Mon Sep 17 00:00:00 2001 From: jwetzell Date: Mon, 8 Apr 2019 09:34:10 -0500 Subject: [PATCH] Move updater to its own thread --- .../Classes/Communication/QUpdater.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qController.Standard/Classes/Communication/QUpdater.cs b/qController.Standard/Classes/Communication/QUpdater.cs index 3cda96a..7a59035 100644 --- a/qController.Standard/Classes/Communication/QUpdater.cs +++ b/qController.Standard/Classes/Communication/QUpdater.cs @@ -1,4 +1,5 @@ using System; +using System.Threading; using Xamarin.Forms; using SharpOSC; namespace qController @@ -7,20 +8,25 @@ namespace qController { private bool active = true; private QController qController; + private Thread updateThread; public QUpdater(QController controller) { qController = controller; + updateThread = new Thread(new ThreadStart(UpdateLoop)); } public void Start(){ + updateThread.Start(); + } + + public void UpdateLoop() + { active = true; Device.StartTimer(TimeSpan.FromSeconds(0.01), () => { - //qController.sendCommandUDP("/selectedCues"); UpdateSelected(); UpdateLevels(); return active; }); - } public void UpdateSelected() @@ -35,6 +41,7 @@ namespace qController public void Kill(){ active = false; + updateThread.Abort(); } } }