Added focus button for camera

This commit is contained in:
Mituniewicz Robert
2012-07-16 20:37:11 +02:00
parent 07a817d93b
commit 151f61c9ec
3 changed files with 23 additions and 0 deletions

View File

@@ -36,6 +36,13 @@
</VideoBrush>
</Rectangle.Fill>
</Rectangle>
<Button Height="100" Width="100" x:Name="_focusButton"
Click="_focusButton_Click" Margin="368,656,12,44"
FontSize="18" Background="Black" Foreground="White">
<TextBlock Text="Focus"/>
</Button>
<Border Height="400" Width="240" BorderBrush="Green" BorderThickness="3">
</Border>
</Grid>

View File

@@ -120,6 +120,7 @@ namespace BarcodeScanner
return false;
}
_timer.Stop();
_timer = null;
_luminance = null;
_reader = null;
_photoCamera.Dispose();
@@ -127,5 +128,20 @@ namespace BarcodeScanner
return true;
}
private void _focusButton_Click(object sender, RoutedEventArgs e)
{
if (_photoCamera != null && _photoCamera.IsFocusSupported)
{
try
{
_photoCamera.CancelFocus();
_photoCamera.Focus();
}
catch
{
}
}
}
}
}