Пример #1
0
 private void BackgroundLoop(Action <VideoFrame> updateColor)
 {
     try
     {
         while (!_tokenSource.Token.IsCancellationRequested)
         {
             using (var frames = _pipeline.WaitForFrames())
             {
                 var colorFrame = frames.ColorFrame.DisposeWith(frames);
                 if (_state.Equals(State.Recording))
                 {
                     _dispatcher.InvokeAsync(() => _recorder.RecordBitmap(colorFrame.Data));
                 }
                 ExecuteInUi(updateColor, colorFrame);
             }
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }