mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-07 16:33:45 +00:00
Move updater to its own thread
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user