public RootTopic(IBotContext context) : base(context) { // User state initialization should be done once in the welcome // new user feature. Placing it here until that feature is added. if (context.State.UserProperties[Constants.USER_STATE_WORKITEMS] == null) { context.State.UserProperties[Constants.USER_STATE_WORKITEMS] = new List <Workitem>(); } this.SubTopics.Add(Constants.ADD_WORKITEM_TOPIC, () => { var addWorkitemTopic = new AddWorkItemTopic(); if (context.State.UserProperties["owner"] != null && addWorkitemTopic.State.Workitem != null) { addWorkitemTopic.State.Workitem.Owner = context.State.UserProperties["owner"]; } addWorkitemTopic.Set .OnSuccess((ctx, workitem) => { this.ClearActiveTopic(); workitem.Attachment = $"{Startup.BlobEndPoint}{Startup.BlobContainerName}/{workitem.Attachment}"; ((List <Workitem>)ctx.State.UserProperties[Constants.USER_STATE_WORKITEMS]).Add(workitem); WorkItemsView.ShowWorkItems(context, context.State.UserProperties[Constants.USER_STATE_WORKITEMS], Accessor, true); SqlUtils sql = new SqlUtils(Startup.ConnectionString); sql.CreateNewWorkItem(workitem); }) .OnFailure((ctx, reason) => { this.ClearActiveTopic(); context.Reply("Let's try something else."); this.ShowDefaultMessage(ctx); }); return(addWorkitemTopic); }); }