SoundPlayer.LoadCompleted 事件

定义

当成功或未成功加载 .wav 文件时出现。

public:
 event System::ComponentModel::AsyncCompletedEventHandler ^ LoadCompleted;
public event System.ComponentModel.AsyncCompletedEventHandler LoadCompleted;
public event System.ComponentModel.AsyncCompletedEventHandler? LoadCompleted;
member this.LoadCompleted : System.ComponentModel.AsyncCompletedEventHandler 
Public Custom Event LoadCompleted As AsyncCompletedEventHandler 

事件类型

示例

下面的代码示例演示如何使用 OnLoadCompleted 事件处理程序接收指示已加载.wav文件内容的通知。 此代码示例是为 SoundPlayer 类提供的一个更大示例的一部分。

// Handler for the LoadCompleted event.
void player_LoadCompleted( Object^ /*sender*/, AsyncCompletedEventArgs^ /*e*/ )
{
   String^ message = String::Format( "LoadCompleted: {0}", this->filepathTextbox->Text );
   ReportStatus( message );
   EnablePlaybackControls( true );
}
// Handler for the LoadCompleted event.
private void player_LoadCompleted(object sender, 
    AsyncCompletedEventArgs e)
{   
    string message = String.Format("LoadCompleted: {0}", 
        this.filepathTextbox.Text);
    ReportStatus(message);
    EnablePlaybackControls(true);
}
' Handler for the LoadCompleted event.
Private Sub player_LoadCompleted(ByVal sender As Object, _
    ByVal e As AsyncCompletedEventArgs)

    Dim message As String = [String].Format("LoadCompleted: {0}", _
        Me.filepathTextbox.Text)
    ReportStatus(message)
    EnablePlaybackControls(True)

End Sub

注解

加载.wav文件时,将引发此事件。 事件参数指示声音的加载是成功完成还是失败。

有关如何处理事件的详细信息,请参阅 处理和引发事件

适用于

另请参阅