void SetVolume(Object sender, CommandEventArgs args) { _logger.Debug("SetVolume {0}", args); float volume; if (args == null) { throw new ArgumentException("SetVolume: expecting a single float 0..100 argurment for SetVolume"); } try { volume = (float)Convert.ToDouble(args); } catch (FormatException) { throw new ArgumentException("SetVolume: Invalid format, expecting a single float 0..100 argurment for SetVolume"); } if (volume < 0.0 || volume > 100.0) { throw new ArgumentException(string.Format("SetVolume: Invalid Volume {0}. Volume range is 0..100", volume)); } _playbackManager.SetVolume(volume); }
void socket_SetVolumeCommand(object sender, GenericEventArgs <int> e) { _playbackManager.SetVolume(e.Argument); }