public override void ChangeIcon(UI.Component.TrayIcon trayIcon) { using var enumerator = new MMDeviceEnumerator(); using var defaultAudio = enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Console); trayIcon.ReplaceIcon(new DeviceFullInfo(defaultAudio).SmallIcon); }
public void ChangeIcon(UI.Component.TrayIcon trayIcon, DeviceFullInfo deviceInfo) { if (!NeedsToChangeIcon(deviceInfo)) { return; } trayIcon.ReplaceIcon(deviceInfo.SmallIcon); }
public override void ChangeIcon(UI.Component.TrayIcon trayIcon) { var defaultAudio = AudioSwitcher.Instance.GetDefaultAudioEndpoint(EDataFlow.eCapture, ERole.eConsole); if (defaultAudio != null) { trayIcon.ReplaceIcon(defaultAudio.SmallIcon); } }
public override void ChangeIcon(UI.Component.TrayIcon trayIcon) { using var enumerator = new MMDeviceEnumerator(); try { using var defaultAudio = enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Console); trayIcon.ReplaceIcon(new DeviceFullInfo(defaultAudio).SmallIcon); } catch (System.Runtime.InteropServices.COMException e) { // Only handle "Element Not Found" if (e.ErrorCode == E_NOT_SET) { // Set to app icon trayIcon.ReplaceIcon(Resources.Switch_SoundWave); } else { // Throw other ErrorCodes throw e; } } }
public abstract void ChangeIcon(UI.Component.TrayIcon trayIcon);
public void ChangeIcon(UI.Component.TrayIcon trayIcon, DeviceFullInfo deviceInfo) { }
public void ChangeIcon(UI.Component.TrayIcon trayIcon) { trayIcon.ReplaceIcon(Resources.Switch_SoundWave); }