小さなテスト カメラ アプリケーションを作成しています。ハードウェア カメラ ボタンを半分押したときに、フォーカス テキスト バーを画面に表示できる機能を実装できるようにしたいと考えています。フォーカス アクションを実行するための camera_ButtonHalfPress イベントを作成しましたが、それに応じて画面に表示するテキスト バーを切り替える方法がわかりません。基本的に、私の目標は、カメラ ボタンが半分押されている間にテキスト バーを表示し、ボタンが完全に押された場合、またはボタンが完全に押される前に離された場合にテキスト バーを削除することです。ボタンが離されているのは、私が苦労している部分です。私が持っているものは次のとおりです。
MainPage.xaml.cs
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
...
//Event is fired when the button is half pressed
CameraButtons.ShutterKeyHalfPressed += camera_ButtonHalfPress;
//Event is fired when the button is fully pressed
CameraButtons.ShutterKeyPressed += camera_ButtonFullPress;
}
private void camera_ButtonHalfPress(object sender, EventArgs e)
{
//camera.Focus();
// Show the focus brackets.
focusBrackets.Visibility = Visibility.Visible;
}
}
private void camera_ButtonFullPress(object sender, EventArgs e)
{
// Hide the focus brackets.
focusBrackets.Visibility = Visibility.Collapsed;
camera.CaptureImage();
}
}
現在、ユーザーがカメラ ボタンを完全に押す前に放すと、フォーカス ブラケットが画面に残ります。この問題を解決するにはどうすればよいですか?