internal void ParticipantUpdate(string URI, bool isMuted, bool isSpeaking, int volume, float energy) { lock (knownParticipants) { // Locate in this session VoiceParticipant p = FindParticipant(URI); if (p == null) { return; } // Set properties p.SetProperties(isSpeaking, isMuted, energy); // Inform interested parties. if (OnParticipantUpdate != null) { OnParticipantUpdate(p, null); } } }
internal void AddParticipant(string URI) { lock (knownParticipants) { VoiceParticipant p = FindParticipant(URI); // We expect that to come back null. If it is not // null, this is a duplicate if (p != null) { return; } // It was not found, so add it. p = new VoiceParticipant(URI, this); knownParticipants.Add(URI, p); /* TODO * // Fill in the name. * if (p.Name == null || p.Name.StartsWith("Loading...")) * p.Name = control.instance.getAvatarName(p.ID); * return p; */ // Inform interested parties. if (OnParticipantAdded != null) { OnParticipantAdded(p, null); } } }
internal void RemoveParticipant(string URI) { lock (knownParticipants) { VoiceParticipant p = FindParticipant(URI); if (p == null) { return; } // Remove from list for this session. knownParticipants.Remove(URI); // Inform interested parties. if (OnParticipantRemoved != null) { OnParticipantRemoved(p, null); } } }
internal void AddParticipant(string URI) { lock (knownParticipants) { VoiceParticipant p = FindParticipant(URI); // We expect that to come back null. If it is not // null, this is a duplicate if (p != null) { return; } // It was not found, so add it. p = new VoiceParticipant(URI, this); knownParticipants.Add(URI, p); /* TODO // Fill in the name. if (p.Name == null || p.Name.StartsWith("Loading...")) p.Name = control.instance.getAvatarName(p.ID); return p; */ // Inform interested parties. if (OnParticipantAdded != null) OnParticipantAdded(p, null); } }
/// <summary> /// Open context menu for voice items /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void RadegastContextMenuStrip_OnContentMenuOpened(object sender, RadegastContextMenuStrip.ContextMenuEventArgs e) { lock (e.Menu) { // Figure out what this menu applies to. if (e.Menu.Selection is ListViewItem) { ListViewItem item = e.Menu.Selection as ListViewItem; if (item.Tag is VoiceParticipant) { selected = item.Tag as VoiceParticipant; ToolStripButton muteButton; if (selected.IsMuted) muteButton = new ToolStripButton("Unmute", null, new EventHandler(OnUnMuteClick)); else muteButton = new ToolStripButton("Mute", null, new EventHandler(OnMuteClick)); e.Menu.Items.Add(muteButton); } } } }
ListViewItem FindParticipantItem(VoiceParticipant p) { foreach (ListViewItem item in participants.Items) { if (item.Tag == p) return item; } return null; }