public FrameInformation GetCleanFrame() { HandleDesktop(); var setCurrent = Desktop.SetCurrent(_lastDesktopInput); return(!setCurrent ? null : ScreenData.DesktopCapture()); }
private void GetScreenFrame() { while (_client != null && _client.IsConnected && _authClient != null && !_authClient.ShutDownScreenShare) { if (RunningAsService && DesktopWatcher.CurrentDesktop != null) { Desktop.SetCurrent(DesktopWatcher.CurrentDesktop); } try { var image = ScreenData.DesktopCapture(); if (image == null) { continue; } if (image.UsingGpu) { SendGpuFrame(image.FinishedRegions); } else { SendPolledFrame(image.ScreenImage, image.Bounds); } } catch (Exception e) { // Console.WriteLine(e.Message + " " + e.StackTrace); } } Console.WriteLine("Screen Share Died"); }