private void uncheckAllMobsOfCurrentlySelectedTypeAndXPToolStripMenuItem_Click(object sender, EventArgs e) { MobXPValues selectedMob = GetRCSelectedMob(); if (selectedMob != null) { var mobXPVals = MobXPHandler.Instance.CompleteMobList; try { checkingMobList = true; for (int i = 0; i < mobList.Items.Count; i++) { MobXPValues mob = mobXPVals.ElementAt(i); if ((mob.Name == selectedMob.Name) && (mob.BaseXP == selectedMob.BaseXP)) { mobList.SetSelected(i, false); } } } finally { checkingMobList = false; } UpdateFilter(); } }
private void mobListContextMenuStrip_Opening(object sender, CancelEventArgs e) { MobXPValues mob = GetRCSelectedMob(); if ((mob == null) || (mobList.Items.Count == 0)) { checkAllMobsBelowCurrentSelectionToolStripMenuItem.Enabled = false; uncheckAllMobsBelowCurrentSelectionToolStripMenuItem.Enabled = false; checkAllMobsOfCurrentlySelectedTypeToolStripMenuItem.Enabled = false; uncheckAllMobsOfCurrentlySelectedTypeToolStripMenuItem.Enabled = false; checkAllMobsOfCurrentlySelectedTypeAndXPToolStripMenuItem.Enabled = false; uncheckAllMobsOfCurrentlySelectedTypeAndXPToolStripMenuItem.Enabled = false; return; } checkAllMobsOfCurrentlySelectedTypeToolStripMenuItem.Text = string.Format("{0}: {1}", GetBaseToolStripContextMenuString(checkAllMobsOfCurrentlySelectedTypeToolStripMenuItem), mob.Name); checkAllMobsOfCurrentlySelectedTypeAndXPToolStripMenuItem.Text = string.Format("{0}: {1} ({2})", GetBaseToolStripContextMenuString(checkAllMobsOfCurrentlySelectedTypeAndXPToolStripMenuItem), mob.Name, mob.BaseXP); checkAllMobsBelowCurrentSelectionToolStripMenuItem.Text = string.Format("{0}: {1} (#{2})", GetBaseToolStripContextMenuString(checkAllMobsBelowCurrentSelectionToolStripMenuItem), mob.Name, mob.BattleID); uncheckAllMobsOfCurrentlySelectedTypeToolStripMenuItem.Text = string.Format("{0}: {1}", GetBaseToolStripContextMenuString(uncheckAllMobsOfCurrentlySelectedTypeToolStripMenuItem), mob.Name); uncheckAllMobsOfCurrentlySelectedTypeAndXPToolStripMenuItem.Text = string.Format("{0}: {1} ({2})", GetBaseToolStripContextMenuString(uncheckAllMobsOfCurrentlySelectedTypeAndXPToolStripMenuItem), mob.Name, mob.BaseXP); uncheckAllMobsBelowCurrentSelectionToolStripMenuItem.Text = string.Format("{0}: {1} (#{2})", GetBaseToolStripContextMenuString(uncheckAllMobsBelowCurrentSelectionToolStripMenuItem), mob.Name, mob.BattleID); checkAllMobsBelowCurrentSelectionToolStripMenuItem.Enabled = true; uncheckAllMobsBelowCurrentSelectionToolStripMenuItem.Enabled = true; checkAllMobsOfCurrentlySelectedTypeToolStripMenuItem.Enabled = true; uncheckAllMobsOfCurrentlySelectedTypeToolStripMenuItem.Enabled = true; checkAllMobsOfCurrentlySelectedTypeAndXPToolStripMenuItem.Enabled = true; uncheckAllMobsOfCurrentlySelectedTypeAndXPToolStripMenuItem.Enabled = true; }
private MobXPValues GetRCSelectedMob() { // Can't depend on mobList.SelectedIndex to be accurate to the // item selected with a right-click, so storing in a local class // variable. MobXPValues mob = null; try { if (rightClickIndex >= 0) { mob = MobXPHandler.Instance.CompleteMobList.ElementAt(rightClickIndex); } } catch (Exception) { } return(mob); }