public CallbackHolder(DotNetCallback toWrap, NativeNodeHost parent) { Wrapped = toWrap; _wrapper = OnCalled; CallbackPtr = Marshal.GetFunctionPointerForDelegate(_wrapper); _parent = parent; }
public static ReplyButton Add(string command, CallbackSignature callback) { if (!ReplyButtons.ContainsKey(command)) { ReplyButton rb = new ReplyButton(command, callback.AsReplyCallback()); ReplyButtons.Add(command, rb); return(rb); } else { throw new InvalidOperationException($"Не удалось добавить команду {command}.\n" + "Команда с таким же названием уже была добавлена.\n"); } }
public static InlineCallback AsInlineCallback(this CallbackSignature callback, string butName) { return(new InlineCallback(callback, butName)); }
public static ReplyCallback AsReplyCallback(this CallbackSignature callback) { return(new ReplyCallback(callback)); }
public InlineCallback(CallbackSignature callback, string buttonName) : base(callback) { _buttonName = buttonName; }
public ReplyCallback(CallbackSignature callback) : base(callback) { }
public Callback(CallbackSignature callback) { CallbackSignature = callback; }
protected TelegramButton(InlineKeyboardButton button, CallbackSignature callbackFunc) { InlineButton = button; Button = null; Callback = callbackFunc.AsInlineCallback(button.Text); }
protected TelegramButton(KeyboardButton button, CallbackSignature callbackFunc) { Button = button; InlineButton = null; Callback = callbackFunc.AsReplyCallback(); }