Sub-action C# code, one In three scenarios simultaneously

Sub-action C# code,

In three scenarios simultaneously:

  • from the type of Presentation (number),
  • a specific amount with currency,
  • the extent of the tip.

alternating pressing the ‘Press key’ Shift+1 and Shift+2
is this possible? how would you improve my Sub-Action code:

Code:

using System;

public class CPHInline
{
public bool Execute()
{
// Retrieving the arguments passed from the IFTTT / main action
CPH.TryGetArg(“gift”, out string gift);
CPH.TryGetArg(“currency”, out string currency);
CPH.TryGetArg(“amount”, out string amountStr);
CPH.TryGetArg(“points”, out string pointsStr);

    // Downloading global variables (Persisted option)
    int toggleState = CPH.GetGlobalVar<int?>("keyToggleState", true) ?? 0;

    // Parsing of numerical values
    double.TryParse(amountStr, out double amount);
    int.TryParse(pointsStr, out int points);

    // Condition scenarios
    bool scenario1 = !string.IsNullOrEmpty(gift) && gift == "121212";
    bool scenario2 = currency == "USD" && amount == 10.0;
    bool scenario3 = points >= 1 && points <= 10;

    // If no scenario is met, continue with further sub-actions
    if (!(scenario1 || scenario2 || scenario3))
        return true;

    // Key selection based on alternate state
    if (toggleState == 0)
    {
        CPH.KeyboardPress("{SHIFT+5}");          // first call
        CPH.LogInfo("Wywołano Shift+5");
    }
    else
    {
        CPH.KeyboardPress("{SHIFT+6}");         // subsequent call
        CPH.LogInfo("Wywołano Shift+6");
    }

    // Switch state for the next call
    CPH.SetGlobalVar("keyToggleState", toggleState == 0 ? 1 : 0, true);

    // Return false to stop further sub-actions in this action
    return false;
}

}

and if none of the conditions are met, performs another sub-action.