private void OnDefaultDeviceChanged(object sender, DefaultDeviceChangedEventArgs e) { // For some reason this event triggers twice. // We keep track of the previous state, and only raise the event if // we are now the default device and were not before. if (IsDefault && !_wasDefault) { _wasDefault = true; DeviceDefaultChanged?.Invoke(this); } else { _wasDefault = false; } }
private void OnDefaultDeviceChanged(object sender, DefaultDeviceChangedEventArgs e) { if (e.DataFlow != Flow.ToDataFlow()) { return; } bool newDefault = e.DeviceId == DeviceId; if (IsDefault != newDefault) { AppLogging.DebugLog(nameof(OnDefaultDeviceChanged), DeviceId, newDefault.ToString()); IsDefault = newDefault; DeviceDefaultChanged?.Invoke(this); } }
public void OnDefaultDeviceChanged(DataFlow flow, Role role, string defaultDeviceId) { if (flow != Flow.ToDataFlow()) { return; } bool newDefault = defaultDeviceId == DeviceId; if (IsDefault != newDefault) { m_Logger.Debug(string.Join("\t", nameof(OnDefaultDeviceChanged), DeviceId, newDefault)); IsDefault = newDefault; DeviceDefaultChanged?.Invoke(this); } }