private void _OnGroupUpdated() { vcGroup.Active = true; vcGroup.Muted = m_Group.muted; vcGroup.OnVolumeChanged -= VcGroup_OnVolumeChanged; vcGroup.Percent = m_Group.VolumePercent; vcGroup.OnVolumeChanged += VcGroup_OnVolumeChanged; if (m_Stream != null) { m_Stream.SERVER_OnStreamUpdated -= _OnStreamUpdated; // unhook event from old m_Stream object } m_Stream = m_SnapcastClient.GetStream(m_Group.stream_id); if (m_Stream != null) { m_Stream.SERVER_OnStreamUpdated += _OnStreamUpdated; // hook up event to new m_Stream object lbGroup.Text = string.Format("{0} - {1} ({2})", m_Group.Name, m_Stream.id, m_Stream.status); } }
private void _OnGroupUpdated() { vcGroup.Active = true; lbGroupName.Content = m_Group.Name; vcGroup.Muted = m_Group.muted; vcGroup.OnVolumeChanged -= VcGroup_OnVolumeChanged; vcGroup.Percent = m_Group.VolumePercent; vcGroup.OnVolumeChanged += VcGroup_OnVolumeChanged; if (m_Stream != null) { m_Stream.SERVER_OnStreamUpdated -= _OnStreamUpdated; // unhook event from old m_Stream object m_Stream.SERVER_OnStreamPropertiesUpdated -= _OnStreamPropertiesUpdated; } m_Stream = m_SnapcastClient.GetStream(m_Group.stream_id); if (m_Stream != null) { m_Stream.SERVER_OnStreamUpdated += _OnStreamUpdated; // hook up event to new m_Stream object _OnStreamUpdated(); m_Stream.SERVER_OnStreamPropertiesUpdated += _OnStreamPropertiesUpdated; } _OnStreamPropertiesUpdated(); }
/// <summary> /// Called when we locally send a control command to the stream (play/pause/next/prev/etc) /// </summary> /// <param name="stream"></param> /// <param name="command"></param> private void _OnStreamControlCommandSent(JsonRpcData.Stream stream, Stream.EControlCommand command) { Task t = Task.Run(async() => { await _SendStreamControlCommandAsync(stream.id, command.ToString()).ConfigureAwait(false); }); }