public bool Stop()
        {
            StopScript();

            if (!ServiceStarted)
            {
                return(false);
            }

            _virtualDisplay?.Release();
            _virtualDisplay = null;

            _imgListener?.Dispose();
            _imgListener = null;

            _imageReader?.Close();
            _imageReader = null;

            _mediaProjection?.Stop();
            _mediaProjection = null;

            ScreenshotManager.ReleaseMemory();
            ImageLocator.ClearCache();

            _windowManager.RemoveView(_layout);
            ServiceStarted = false;

            HideForegroundNotification();

            return(true);
        }
Example #2
0
        public bool Stop()
        {
            StopScript();

            if (!ServiceStarted)
            {
                return false;
            }

            _sshotService.Dispose();
            _sshotService = null;

            _gestureService.Dispose();
            _gestureService = null;

            _superUser?.Dispose();
            _superUser = null;

            ScreenshotManager.ReleaseMemory();
            ImageLocator.ClearCache();

            _windowManager.RemoveView(_layout);
            _windowManager.RemoveView(_highlightView);
            ServiceStarted = false;

            HideForegroundNotification();

            return true;
        }