Move try catch, because i had issues with it throwing when doing the tick - oops
This commit is contained in:
parent
f0a5a48c73
commit
0d056215bc
@ -137,7 +137,6 @@ public class DialAction : EncoderBase
|
||||
public override void DialUp(DialPayload payload)
|
||||
{
|
||||
//dial unpressed
|
||||
Logger.Instance.LogMessage(TracingLevel.INFO, "Dial Up");
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
@ -151,6 +150,8 @@ public class DialAction : EncoderBase
|
||||
}
|
||||
|
||||
public override async void OnTick()
|
||||
{
|
||||
try
|
||||
{
|
||||
//called once every 1000ms and can be used for updating the title/image of the key
|
||||
var activeSession = _audioHelper.GetActiveSession(settings.FallbackBehavior);
|
||||
@ -162,6 +163,11 @@ public class DialAction : EncoderBase
|
||||
|
||||
await UpdateStateIfNeeded();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Instance.LogMessage(TracingLevel.ERROR, $"Exception on WinEventProc\n {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task UpdateStateIfNeeded()
|
||||
{
|
||||
@ -207,16 +213,8 @@ public class DialAction : EncoderBase
|
||||
|
||||
|
||||
public void WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime)
|
||||
{
|
||||
try
|
||||
{
|
||||
OnTick();
|
||||
Thread.Sleep(TimeSpan.FromSeconds(1));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Instance.LogMessage(TracingLevel.ERROR, $"Exception on WinEventProc\n {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user