File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
src/MachineLearning.ObjectDetect.WPF/Views Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -55,11 +55,18 @@ public WebcamView()
55
55
ViewModel . CameraOpenCv . ImageGrabbed . Subscribe ( async imageGrabbedData =>
56
56
{
57
57
// Update frame in UI thread
58
- await System . Windows . Application . Current . Dispatcher . InvokeAsync ( ( ) =>
58
+ try
59
59
{
60
- CurrentFPSTextBlock . Text = imageGrabbedData . CurrentFPS . ToString ( "N1" ) ;
61
- WebcamImage . Source = imageGrabbedData . image . ToBitmapSource ( ) ;
62
- } ) ;
60
+ await System . Windows . Application . Current . Dispatcher . InvokeAsync ( ( ) =>
61
+ {
62
+ CurrentFPSTextBlock . Text = imageGrabbedData . CurrentFPS . ToString ( "N1" ) ;
63
+ WebcamImage . Source = imageGrabbedData . image . ToBitmapSource ( ) ;
64
+ } ) ;
65
+ }
66
+ catch ( TaskCanceledException )
67
+ {
68
+ // App shutting down
69
+ }
63
70
} ) . DisposeWith ( disposableRegistration ) ;
64
71
65
72
// Interactions
You can’t perform that action at this time.
0 commit comments