protected async override void OnNavigatedTo(NavigationEventArgs e) { InitializeVisuals(); await InitializeVideoAsync(); _audioMatrix = await AudioMatrix.CreateAsync(CellsRowsCount, CellsColumnsCount); _faceMatrix.Frame += (sender, args) => { #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed { RenderFaceRectangles(args.PreviewFrameSize, args.DetectedFaces); // remove background for cells from previous frame SetCellsFill(args.PreviousFaceCells, null); // set background for cells with faces on the current frame SetCellsFill(args.NewFaceCells, _currentCellFillBrush); // and play corresponding sound _audioMatrix.PlayCells(args.NewFaceCells); }); }; }
protected async override void OnNavigatedTo(NavigationEventArgs e) { InitializeVisuals(); await InitializeVideoAsync(); _audioMatrix = await AudioMatrix.CreateAsync(CellsRowsCount, CellsColumnsCount); _faceMatrix.Frame += (sender, args) => { #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed { RenderFaceRectangles(args.PreviewFrameSize, args.DetectedFaces); // remove background for cells from previous frame SetCellsFill(args.PreviousFaceCells, null); // set background for cells with faces on the current frame SetCellsFill(args.NewFaceCells, _currentCellFillBrush); // and play corresponding sound _audioMatrix.PlayCells(args.NewFaceCells); }); }; }