public void Initialize(IMultimediaManager mgr, string chatGroupID)
        {
            this.multimediaManager = mgr;
            this.chatGroup         = this.multimediaManager.ChatGroupEntrance.Join(ChatType.Audio, chatGroupID);

            this.decibelDisplayer_mic.Working     = true;
            this.decibelDisplayer_speaker.Working = true;
            this.multimediaManager.AudioCaptured += new ESBasic.CbGeneric <byte[]>(multimediaManager_AudioCaptured);
            this.multimediaManager.AudioPlayed   += new ESBasic.CbGeneric <byte[]>(multimediaManager_AudioPlayed);

            this.chatGroup.SomeoneJoin += new ESBasic.CbGeneric <IChatUnit>(chatGroup_SomeoneJoin);
            this.chatGroup.SomeoneExit += new CbGeneric <string>(chatGroup_SomeoneExit);

            SpeakerAudioPanel myselfPanel = new SpeakerAudioPanel();

            myselfPanel.Initialize(this.chatGroup.MyChatUnit, true);
            this.flowLayoutPanel1.Controls.Add(myselfPanel);
            foreach (IChatUnit unit in this.chatGroup.GetOtherMembers())
            {
                SpeakerAudioPanel panel = new SpeakerAudioPanel();
                panel.Initialize(unit, false);
                this.flowLayoutPanel1.Controls.Add(panel);
            }

            this.groupBox_members.Text = string.Format("成员列表({0}人)", this.flowLayoutPanel1.Controls.Count);

            this.flowLayoutPanel1_SizeChanged(this.flowLayoutPanel1, new EventArgs());
        }
        void chatGroup_SomeoneExit(string memberID)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new CbGeneric <string>(this.chatGroup_SomeoneExit), memberID);
            }
            else
            {
                SpeakerAudioPanel target = null;
                foreach (SpeakerAudioPanel panel in this.flowLayoutPanel1.Controls)
                {
                    if (panel.MemberID == memberID)
                    {
                        target = panel;
                        break;
                    }
                }

                if (target == null)
                {
                    return;
                }

                this.flowLayoutPanel1.Controls.Remove(target);
                this.groupBox_members.Text = string.Format("成员列表 ({0}人)", this.flowLayoutPanel1.Controls.Count);
                this.toolStripLabel1.Text  = string.Format("{0} 退出了组!", memberID);
            }
        }
Exemple #3
0
 void chatGroup_SomeoneJoin(IChatUnit unit)
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke(new CbGeneric <IChatUnit>(this.chatGroup_SomeoneJoin), unit);
     }
     else
     {
         SpeakerAudioPanel panel = new SpeakerAudioPanel();
         panel.Width = this.flowLayoutPanel1.Width - 2;
         panel.Initialize(unit, false);
         this.flowLayoutPanel1.Controls.Add(panel);
         this.groupBox_members.Text = string.Format("成员列表 ({0}人)", this.flowLayoutPanel1.Controls.Count);
     }
 }