示例#1
0
 public CallbackHolder(DotNetCallback toWrap, NativeNodeHost parent)
 {
     Wrapped     = toWrap;
     _wrapper    = OnCalled;
     CallbackPtr = Marshal.GetFunctionPointerForDelegate(_wrapper);
     _parent     = parent;
 }
示例#2
0
 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");
     }
 }
示例#3
0
 public static InlineCallback AsInlineCallback(this CallbackSignature callback, string butName)
 {
     return(new InlineCallback(callback, butName));
 }
示例#4
0
 public static ReplyCallback AsReplyCallback(this CallbackSignature callback)
 {
     return(new ReplyCallback(callback));
 }
示例#5
0
 public InlineCallback(CallbackSignature callback, string buttonName) : base(callback)
 {
     _buttonName = buttonName;
 }
示例#6
0
 public ReplyCallback(CallbackSignature callback) : base(callback)
 {
 }
示例#7
0
 public Callback(CallbackSignature callback)
 {
     CallbackSignature = callback;
 }
示例#8
0
 protected TelegramButton(InlineKeyboardButton button, CallbackSignature callbackFunc)
 {
     InlineButton = button;
     Button       = null;
     Callback     = callbackFunc.AsInlineCallback(button.Text);
 }
示例#9
0
 protected TelegramButton(KeyboardButton button, CallbackSignature callbackFunc)
 {
     Button       = button;
     InlineButton = null;
     Callback     = callbackFunc.AsReplyCallback();
 }