public ActivityExecutionResult Execute(IExecuteContext context) { if (context.IsContinue) { return(ActivityExecutionResult.Complete); } var chat = Guid.Parse(context.Resolve(ChatId)); var msgs = GetMessages().Select(msg => { var m = new StorableOutgoingMessage(); m.Restore(msg, null); m.Resolve(context); return(new SendMessageMessage(m) { BotEngine = BotEngine, BotKey = BotKey, ChatId = chat } as Infrastructure.IMessage); }).ToList(); if (Sync) { var book = context.SetBookmark(); var rmsg = new ResumeBookmarkMessage(book, new DynamicObject()); msgs.Add(rmsg); context.SendMessagesSequence(msgs.ToArray()); return(ActivityExecutionResult.Idle); } else { context.SendMessagesSequence(msgs.ToArray()); return(ActivityExecutionResult.Complete); } }
public ActivityExecutionResult Execute(IExecuteContext context) { if (context.IsContinue) { return(ActivityExecutionResult.Complete); } var book = context.SetBookmark(); var ch = Guid.Parse(context.Resolve(ChatId)); var mess = new WaitMessageMessage(ch) { BookmarkId = book, BotEngine = BotEngine, BotKey = BotKey }; context.SendMessage(mess); return(ActivityExecutionResult.Idle); }