jonka 余小章 's 7 vuotta sitten
612
Lisää tämän kaltaisia
public event EventHandler<ConnectCompletedEventArgs> ConnectCompleted;
e 代表的是通知內容
sender代表的是觸發事件的來源物件
public delegate void EventHandler
EventHandler 就是傳入兩個參數,object,TEventArgs 沒有回傳值的委派
protected virtual void OnConnect(ConnectCompletedEventArgs e)
{
if (ConnectCompleted != null)
{
ConnectCompleted(this, e);
}
}
public event ConnectCompletedEventHandler ConnectCompleted;
public delegate void ConnectCompletedEventHandler(object sender, ConnectCompletedEventArgs e);
public class ConnectCompletedEventArgs : EventArgs
{
private bool _isConnected;
public bool IsConnected
{
get { return _isConnected; }
set { _isConnected = value; }
}
}