//定义触发事件的方法 protected virtual void OnNewFrame(FrameReceivedArgs e) { // 第二种做法 //EventHandler<FrameReceivedArgs> temp = NewFrame; //if (temp != null) //{ // temp(this, e); //} NewFrame?.Invoke(this, e); // 这是被注释掉的部分的简化版本,VS给我优化的 }
// 包装好事件参数,调用事件触发函数。 public void ReceivedNewFrame(string s, byte[] b) { FrameReceivedArgs e = new FrameReceivedArgs(s, b); OnNewFrame(e); }
private void Notification_NewFrame(object sender, FrameReceivedArgs e) { throw new NotImplementedException(); }