Ejemplo n.º 1
0
        void JoinOrLeave()
        {
            if ((tv_Sessions.SelectedNode != null) && (tv_Sessions.SelectedNode.Tag != null))
            {
                var session = (ISession)tv_Sessions.SelectedNode.Tag;
                if (session == null)
                {
                    return;
                }

                if (joined.Contains(session))
                {
                    presenter.Leave(session);
                    btn_Join.Text = Constants.JOIN;
                    tv_Sessions.SelectedNode.BackColor = listened.Contains(session) ? Constants.LISTENING_COLOR : tv_Sessions.BackColor;
                }
                else
                {
                    presenter.Join(session);
                    btn_Join.Text = Constants.LEAVE;
                    tv_Sessions.SelectedNode.BackColor = Constants.JOINED_COLOR;
                }
            }
        }