Stop idle timer while remote control access prompt is displayed.

This commit is contained in:
Jared 2020-10-02 15:34:57 -07:00 committed by Jared Goodwin
parent b31d30d535
commit 9d3b1193bf
2 changed files with 13 additions and 0 deletions

View File

@ -13,10 +13,12 @@ namespace Remotely.Desktop.Core.Services
public class CasterSocket
{
public CasterSocket(
IdleTimer idleTimer,
IDtoMessageHandler messageHandler,
IScreenCaster screenCastService,
IRemoteControlAccessService remoteControlAccessService)
{
IdleTimer = idleTimer;
MessageHandler = messageHandler;
ScreenCaster = screenCastService;
RemoteControlAccessService = remoteControlAccessService;
@ -24,6 +26,7 @@ namespace Remotely.Desktop.Core.Services
public HubConnection Connection { get; private set; }
public bool IsConnected => Connection?.State == HubConnectionState.Connected;
private IdleTimer IdleTimer { get; }
private IDtoMessageHandler MessageHandler { get; }
private IScreenCaster ScreenCaster { get; }
private IRemoteControlAccessService RemoteControlAccessService { get; }
@ -176,7 +179,11 @@ namespace Remotely.Desktop.Core.Services
if (enforceAttendedAccess)
{
await SendMessageToViewer(viewerID, "Asking user for permission...");
IdleTimer.Stop();
var result = await RemoteControlAccessService.PromptForAccess(requesterName, organizationName);
IdleTimer.Start();
if (!result)
{
await SendConnectionRequestDenied(viewerID);

View File

@ -26,6 +26,12 @@ namespace Remotely.Desktop.Core.Services
Timer.Start();
}
public void Stop()
{
Timer?.Stop();
Timer?.Dispose();
}
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
{
if (ViewerList.Count > 0)