// Raise the event. protected virtual void OnEmotionChanged() { EmotionChanged.Raise(this, new EmotionChangedEventArgs() { Emotion = this.Emotion }); }
// Raise an event when the emotion of the Emotiv changes. protected virtual void OnEmotionChanged(object sender, EmotionChangedEventArgs e) { var source = sender as EmotivDevice; if (sender == null) { Debug.Assert(false); return; } // This is only necessary if want to do some preprocessing on the data (some business logic). ProcessEmotiveData(source); // Raise the actual event (notify anyone who is listening). EmotionChanged.Raise(source, new EmotionChangedEventArgs() { Emotion = _emotiv.Emotion }); }