Xam.Plugins.ManageSleep
Xam.Plugins.ManageSleep copied to clipboard
Could use a DoWithoutSleepAsync with a Func<task> parameter
This overload makes it easier to simply write anonymous async lambda methods like this:
await _sleepMode.DoWithoutSleepAsync(async () =>
{
await DoSomeStuffAsync();
await DoMoreStuffAsync();
});
New method:
public async Task DoWithoutSleepAsync(Func<Task> func)
{
try
{
ActivateAutoSleepMode(false);
await func();
}
finally
{
ActivateAutoSleepMode(true);
}
}