Exemple #1
0
    public CoreKeyboard AddButton(string text, CoreKeyboardButtonColor color, string payloadKey, string payloadValue)
    {
        var button = new CoreKeyboardButton
        {
            Title = text,
            Color = color
        };

        button.SetPayload(payloadKey, payloadValue);
        LastLine.Add(button);

        return(this);
    }
Exemple #2
0
    private static KeyboardButtonColor FromCoreColorToVk(CoreKeyboardButtonColor coreColor)
    {
        var dict = new Dictionary <CoreKeyboardButtonColor, KeyboardButtonColor>
        {
            [CoreKeyboardButtonColor.Default]  = KeyboardButtonColor.Default,
            [CoreKeyboardButtonColor.Negative] = KeyboardButtonColor.Negative,
            [CoreKeyboardButtonColor.Positive] = KeyboardButtonColor.Positive,
            [CoreKeyboardButtonColor.Primary]  = KeyboardButtonColor.Primary
        };

        if (dict.TryGetValue(coreColor, out var result))
        {
            return(result);
        }

        throw new ArgumentException(nameof(coreColor));
    }