diff --git a/Desktop.Core/Services/CasterSocket.cs b/Desktop.Core/Services/CasterSocket.cs index bf7d104a..39f766be 100644 --- a/Desktop.Core/Services/CasterSocket.cs +++ b/Desktop.Core/Services/CasterSocket.cs @@ -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); diff --git a/Desktop.Core/Services/IdleTimer.cs b/Desktop.Core/Services/IdleTimer.cs index 229e35ae..807a0915 100644 --- a/Desktop.Core/Services/IdleTimer.cs +++ b/Desktop.Core/Services/IdleTimer.cs @@ -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)