public void Begin()
        {
            _isRunning = true;
            var t = new System.Threading.Thread(() =>
            {
                int initialDelay = 100;
                int frameId      = 0;
                var desktop      = new DesktopDuplication.DesktopDuplicator(_window);

                while (_isRunning)
                {
                    var frame = desktop.GetLatestFrame();
                    if (frame == null)
                    {
                        System.Threading.Thread.Sleep(1);
                        continue;
                    }

                    if (initialDelay > 0)
                    {
                        initialDelay--;
                        Thread.Sleep(50);
                    }

                    FrameProduced(frameId++, frame);
                }
            });

            t.IsBackground = true;
            t.Priority     = System.Threading.ThreadPriority.Highest;
            t.Start();
        }
Exemple #2
0
        public TestForm()
        {
            InitializeComponent();

            desktop = new DesktopDuplication.DesktopDuplicator(XboxApp.GetWindow());


            Timer t = new Timer();

            t.Interval = 200;
            t.Tick    += T_Tick;
            t.Start();
        }
 public void Dispose()
 {
     _duplicator = null;
 }
 public ScreenCaptureService(Action <RDPStreaming.Model.BitmapBufferedData[]> callback)
 {
     _duplicator       = new DesktopDuplication.DesktopDuplicator(0, 0);
     _newFrameCallback = callback;
 }