/// <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); } } } }
/// <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. ListViewItem item = e.Menu.Selection as ListViewItem; if (item?.Tag is VoiceParticipant tag) { selected = tag; ToolStripButton muteButton; muteButton = selected.IsMuted ? new ToolStripButton("Unmute", null, OnUnMuteClick) : new ToolStripButton("Mute", null, OnMuteClick); e.Menu.Items.Add(muteButton); } } }