/// <summary> /// Sets the Volume Mixer volume (requires Windows 7 or newer) /// </summary> /// <param name="volume">A value between 0 and 100</param> public void SetSpotifyVolume(float volume = 100) { if (!IsOSCompatible(WindowsSevenMajorVersion, WindowsSevenMinorVersion)) { throw new NotSupportedException("This feature is only available on Windows 7 or newer"); } if (volume < 0 || volume > 100) { throw new ArgumentOutOfRangeException(nameof(volume)); } VolumeMixerControl.SetSpotifyVolume(volume); }
/// <summary> /// Sets the Volume Mixer volume (requires Windows 7 or newer) /// </summary> /// <param name="volume">A value between 0 and 100</param> public void SetSpotifyVolume(float volume = 100) { //Windows < Windows Vista Check if (Environment.OSVersion.Version.Major < 6) { throw new NotSupportedException("This feature is only available on Windows 7 or newer"); } //Windows Vista Check if (Environment.OSVersion.Version.Major == 6) { if (Environment.OSVersion.Version.Minor == 0) { throw new NotSupportedException("This feature is only available on Windows 7 or newer"); } } if (volume < 0 || volume > 100) { throw new ArgumentOutOfRangeException(nameof(volume)); } VolumeMixerControl.SetSpotifyVolume(volume); }