private void PlayerContextMenu_OptionSelected(object sender, ContextMenuOptionEventArgs e) { var lbItem = lbUserList.SelectedItem; if (lbItem == null) { return; } ToggleFriend(lbItem.Text); // lazy solution, but friends are removed rarely so it shouldn't bother players too much if (tabControl.SelectedTab == FRIEND_LIST_VIEW_INDEX) { TabControl_SelectedIndexChanged(this, EventArgs.Empty); } }
private void PlayerContextMenu_OptionSelected(object sender, ContextMenuOptionEventArgs e) { if (lbPlayerList.SelectedIndex < 0 || lbPlayerList.SelectedIndex >= lbPlayerList.Items.Count) { return; } string userName = currentChatChannel.Users[lbPlayerList.SelectedIndex].IRCUser.Name; switch (e.Index) { case 0: pmWindow.InitPM(userName); break; case 1: pmWindow.ToggleFriend(userName); break; } }
private void ContextMenu_OptionSelected(object sender, ContextMenuOptionEventArgs e) { if (sndDropdownSound != null) { AudioMaster.PlaySound(sndDropdownSound); } if (Map.EnforceMaxPlayers) { foreach (PlayerInfo pInfo in players.Concat(aiPlayers)) { if (pInfo.StartingLocation == (int)contextMenu.Tag + 1) { pInfo.StartingLocation = 0; } } } PlayerInfo player; if (e.Index >= players.Count) { int aiIndex = e.Index - players.Count; if (aiIndex >= aiPlayers.Count) { return; } player = aiPlayers[aiIndex]; } else { player = players[e.Index]; } player.StartingLocation = (int)contextMenu.Tag + 1; StartingLocationApplied?.Invoke(this, EventArgs.Empty); }