private async Task CompleteNotificationAsync( BotAdapter adapter, string botId, ChannelLog.ChannelData channelInfo, string message, CancellationToken cancellationToken = default(CancellationToken)) { await adapter.ContinueConversationAsync(botId, channelInfo.Conversation, CreateCallback(channelInfo, message), cancellationToken); }
// Creates and saves channel info private ChannelLog.ChannelData CreateChannel(ITurnContext turnContext, ChannelLog channelLog) { ChannelLog.ChannelData channelInfo = new ChannelLog.ChannelData { TimeStamp = DateTime.Now.ToBinary(), Conversation = turnContext.Activity.GetConversationReference(), }; channelLog[channelInfo.TimeStamp] = channelInfo; return(channelInfo); }
public async Task <string> StartChannel(ITurnContext turnContext) { // Get the channel log. ChannelLog channelLog = await GetChannelLog(turnContext); // Create channel ChannelLog.ChannelData channel = CreateChannel(turnContext, channelLog); // Set the new property await _channelLogPropertyAccessor.SetAsync(turnContext, channelLog); // Now save it into the ChannelState await _channelState.SaveChangesAsync(turnContext); await turnContext.SendActivityAsync( $"We're saving {channel.Conversation.Conversation.Id} for future updates."); return(channel.Conversation.Conversation.Id); }
private BotCallbackHandler CreateCallback(ChannelLog.ChannelData channelInfo, string message) { return(async(turnContext, token) => { // Get the job log from state, and retrieve the job. ChannelLog channelLog = await GetChannelLog(turnContext); // Perform bookkeeping. //channelLog[channelInfo.TimeStamp].Completed = true; // Set the new property //await _channelLogPropertyAccessor.SetAsync(turnContext, channelLog); // Now save it into the JobState //await _channelState.SaveChangesAsync(turnContext); // Send the user a proactive confirmation message. await turnContext.SendActivityAsync($"Notification:\r\nNew Issue has been created: {message}"); }); }