public void OnEnterPressed() { if (weaponSelectorForm != null) { this.poller.PollKeyboardKeysForConfigChange = true; if (weaponSelectorForm.GetSelectedPresetName() != "") { weaponSlotPresetNameDict[activeWeaponSlot] = weaponSelectorForm.GetSelectedPresetName(); HelperFunctions.GetToolStripMenuItemFromText(toolStripMenuItemPresets, weaponSlotPresetNameDict[activeWeaponSlot]).PerformClick(); new MessageToast($"Weapon slot #{activeWeaponSlot}\n{weaponSlotPresetNameDict[activeWeaponSlot]}", 50).Show(); } weaponSelectorForm.Close(); weaponSelectorForm = null; } else { List <ToolStripMenuItem> presetMenuItemsList = HelperFunctions.GetListOfAllPresetMenuItems(toolStripMenuItemPresets); if (presetMenuItemsList.Count > 0) { this.poller.PollKeyboardKeysForConfigChange = false; weaponSelectorForm = new WeaponSelectorForm(presetMenuItemsList); weaponSelectorForm.Show(); } } }
public void OnWeaponSlotChangeHotkeyPressed(int slotNumber) { activeWeaponSlot = slotNumber; try { HelperFunctions.GetToolStripMenuItemFromText(toolStripMenuItemPresets, weaponSlotPresetNameDict[slotNumber]).PerformClick(); } catch (PresetNotFoundException pnfex) { Logger.Log(pnfex.Message); } catch (PresetMenuNotPopulatedException pmnpex) { Logger.Log(pmnpex.Message); } finally { new MessageToast($"Weapon slot #{activeWeaponSlot}\n{weaponSlotPresetNameDict[slotNumber]}", 50).Show(); } }