What should you do to provide optimal performance when the audio file is being played?

You are creating a Windows Presentation Foundation application. You create a window for the application.
The application contains an audio file named AudioFileToPlay.wav.
You need to ensure that the following requirements are met:
* The audio file is played each time you click the client area of the window.
* The window provides optimal performance when the audio file is being played.
What should you do?

You are creating a Windows Presentation Foundation application. You create a window for the application.
The application contains an audio file named AudioFileToPlay.wav.
You need to ensure that the following requirements are met:
* The audio file is played each time you click the client area of the window.
* The window provides optimal performance when the audio file is being played.
What should you do?

A.
Add the following XAML line of code to the window.
<MediaElement Source=”AudioFileToPlay.wav” />

B.
Add the following code segment to the window constructor method in the code-behind file.
SoundPlayer player = new SoundPlayer()
player.SoundLocation = “AudioFileToPlay.wav”
player.Play()

C.
Add the following code segment to the window MouseDown method in the code-behind file.
MediaElement player = new MediaElement();
player.Source = new Uri(“AudioFileToPlay.wav”, UriKind.Relative);
player.LoadedBehavior = MediaState.Manual;
player.Play();

D.
Add the following XAML code fragment to the window.
<Window.Triggers>
<EventTrigger RoutedEvent=”Window.MouseDown”>
<EventTrigger.Actions>
<SoundPlayerAction Source=”AudioFileToPlay.wav”/>
</EventTrigger.Actions>
</EventTrigger>
</Window.Triggers>



Leave a Reply 0

Your email address will not be published. Required fields are marked *