private static void Input_ButtonReleased(object sender, ButtonReleasedEventArgs e) { if (Game1.activeClickableMenu != null && Game1.activeClickableMenu is ItemBagMenu IBM) { if (e.Button == SButton.MouseLeft || e.Button == SButton.MouseMiddle || e.Button == SButton.MouseRight) { try { IBM.OnMouseButtonReleased(e); } catch (Exception ex) { Monitor.Log(string.Format("Unhandled error while handling Mouse button released: {0}\n\n{1}", ex.Message, ex.ToString()), LogLevel.Error); } } else if (e.Button == SButton.LeftShift || e.Button == SButton.RightShift || e.Button == SButton.LeftControl || e.Button == SButton.RightControl) { try { IBM.OnModifierKeyReleased(e); } catch (Exception ex) { Monitor.Log(string.Format("Unhandled error while handling Modifier key released: {0}\n\n{1}", ex.Message, ex.ToString()), LogLevel.Error); } } else if (e.Button.TryGetController(out Buttons GamepadButtons)) { try { // Handle navigation buttons foreach (NavigationDirection Direction in Enum.GetValues(typeof(NavigationDirection)).Cast <NavigationDirection>()) { if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.NavigateSingleButtons[Direction])) { NavigationButtonsPressedTime.Remove(Direction); } } IBM.OnGamepadButtonsReleased(GamepadButtons); } catch (Exception ex) { Monitor.Log(string.Format("Unhandled error while handling Gamepad button released: {0}\n\n{1}", ex.Message, ex.ToString()), LogLevel.Error); } } } }