Multiple question
1. Building Adaptive Cards dynamically
I'm creating an Order
confirm card where there's an entry for every product and quantity. There's also a button to delete the entry and another button to modify its quantity.
The amount of products displayed will vary based on the amount of Product
objects I've stored in a list. The card is a JSON template without any products that I want to be able to modify through my code (add the product columns, the buttons, their respective actions), etc.
What is the best way to accomplish that without having to build a Deserializer? (I don't want to be deserializing every Container
, FactSet
, etc. into useless objects).
2. Updating the Adaptive card
Every Product
row will have a button to delete from the Order
I can achieve that making it inivisble and then deleting the object with a submit action*. But when I change the amount of Products an entry has, how can I update the Product
quantity value without resending the adaptive card?
- Can an Item have a
"selectAction": "Action.toggleVisibility"
and an "type": "Action.Submit"
at the same time?
3. Handling submit actions
All these buttons will have a set of different submit actions. Let's say something like this:
switch(action)
{
case "delete1":
//Deletes product 1 from the Order
break;
case "delete2":
//Deletes product 2 from the Order
break;
...
}
Should this handler go to some type of Middleware, maybe in the bot class (i suppose this shouldn't go in the MainDialog since mine is a WaterFallDialog
). What is the advisable way of handling those?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…