Hololens/Lib/Cameras.cs
//#############################################################################################
/// <summary>
/// When _imageElement is set, update it by displaying the last frame
/// </summary>
When _imageElement is set, update it by displaying the last frame
When _imageElement is set update it by displaying the last frame
public void UpdateDisplay()
        {
            if (_imageElement != null && _displaying.IsCompleted) 
            {
                _displaying = _imageElement.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
                {
                    try
                    {
                        _frame = ImageConverter.ToDisplayableXaml(_frame);
                        var bitmapSource = new SoftwareBitmapSource();
                        await bitmapSource.SetBitmapAsync(_frame);
                        _imageElement.Source = bitmapSource;
                    }
                    catch { }
                }).AsTask();
            }
        }
public void UpdateDisplay ( ) { if ( _imageElement != null && _displaying . IsCompleted ) { _displaying = _imageElement . Dispatcher . RunAsync ( CoreDispatcherPriority . Normal , async ( ) => { try { _frame = ImageConverter . ToDisplayableXaml ( _frame ) ; var bitmapSource = new SoftwareBitmapSource ( ) ; await bitmapSource . SetBitmapAsync ( _frame ) ; _imageElement . Source = bitmapSource ; } catch { } } ) . AsTask ( ) ; } }
When _imageElement is set, update it by displaying the last frame
When _imageElement is set update it by displaying the last frame
// check if _imageElement is set and if last display is finished // to avoid multiple i/o conflict, update is made in a separate task schedule by the _imageElement itself // for being displayable, frame formats must be bgra8 and premultiplied formats // get frame source data and set it to _imageElement