You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. <br /> You want to add an audio player that plays .wav or .mp3 files when the user clicks a button. <br /> You plan to store the name of the file to a variable named SoundFilePath. <br /> You need to ensure that when a user clicks the button, the file provided by SoundFilePath plays. <br /> What should you do?()<p> You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. <br /> You want to add an audio player that plays .wav or .mp3 files when the user clicks a button. <br /> You plan to store the name of the file to a variable named SoundFilePath. <br /> You need to ensure that when a user clicks the button, the file provided by SoundFilePath plays. <br /> What should you do?()</p>
A、A. Write the following code segment in the button onclick event. System.Media. SoundPlayer player = new System.Media. SoundPlayer(SoundFilePath); player.play();
B、B. Write the following code segment in the button onclick event. MediaPlayer player = new MediaPlayer(); player.Open(new URI(SoundFilePath), UriKind.Relative)); player.play();
C、C. Use the following code segment from the PlaySound() Win32 API function and call the PlaySound function in the button onclick event. [sysimport(dll="winmm.dll")] public static extern long PlaySound(String SoundFilePath, long hModule, long dwFlags);
D、D. Reference the Microsoft.DirectX Dynamic Link Libraries. Use the following code segment in the button onclick event. Audio song = new Song(SoundFilePath); song.CurrentPosition = song.Duration; song.Play();