/// <summary> /// Changes the current state and notifies listeners. /// </summary> /// <param name="state">The new state to set the ears to.</param> private void ChangeState(EarsState state) { State = state; var handler = EarsStateChanged; // ReSharper disable once UseNullPropagation if (handler != null) { handler(state); } }
/// <summary> /// Respond to ears state changed event, reporting the event to the UI / logging. /// </summary> /// <param name="state">The new state the ears are in.</param> private void Ears_EarsStateChanged(EarsState state) { ReportEvent("ears", $"state to '{state}'"); }