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)
|
public override void DialUp(DialPayload payload)
|
||||||
{
|
{
|
||||||
//dial unpressed
|
//dial unpressed
|
||||||
Logger.Instance.LogMessage(TracingLevel.INFO, "Dial Up");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
@ -151,6 +150,8 @@ public class DialAction : EncoderBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override async void OnTick()
|
public override async void OnTick()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
//called once every 1000ms and can be used for updating the title/image of the key
|
//called once every 1000ms and can be used for updating the title/image of the key
|
||||||
var activeSession = _audioHelper.GetActiveSession(settings.FallbackBehavior);
|
var activeSession = _audioHelper.GetActiveSession(settings.FallbackBehavior);
|
||||||
@ -162,6 +163,11 @@ public class DialAction : EncoderBase
|
|||||||
|
|
||||||
await UpdateStateIfNeeded();
|
await UpdateStateIfNeeded();
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Instance.LogMessage(TracingLevel.ERROR, $"Exception on WinEventProc\n {ex}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task UpdateStateIfNeeded()
|
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)
|
public void WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
OnTick();
|
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