Dialog: Using Dialog Chain

6 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€46.42
List Price:  €64.99
You save:  €18.57
£39.83
List Price:  £55.77
You save:  £15.93
CA$68.34
List Price:  CA$95.68
You save:  CA$27.34
A$75.68
List Price:  A$105.96
You save:  A$30.28
S$67.48
List Price:  S$94.48
You save:  S$27
HK$390.53
List Price:  HK$546.78
You save:  HK$156.24
CHF 45.23
List Price:  CHF 63.33
You save:  CHF 18.09
NOK kr543.62
List Price:  NOK kr761.11
You save:  NOK kr217.49
DKK kr346.42
List Price:  DKK kr485.02
You save:  DKK kr138.59
NZ$83.17
List Price:  NZ$116.44
You save:  NZ$33.27
د.إ183.60
List Price:  د.إ257.06
You save:  د.إ73.45
৳5,471.12
List Price:  ৳7,660.01
You save:  ৳2,188.88
₹4,168.17
List Price:  ₹5,835.78
You save:  ₹1,667.60
RM236.95
List Price:  RM331.75
You save:  RM94.80
₦61,737.65
List Price:  ₦86,437.65
You save:  ₦24,700
₨13,922.21
List Price:  ₨19,492.21
You save:  ₨5,570
฿1,837.56
List Price:  ฿2,572.74
You save:  ฿735.17
₺1,617.36
List Price:  ₺2,264.43
You save:  ₺647.07
B$253.57
List Price:  B$355.02
You save:  B$101.45
R925.26
List Price:  R1,295.44
You save:  R370.18
Лв90.75
List Price:  Лв127.05
You save:  Лв36.30
₩67,788.68
List Price:  ₩94,909.58
You save:  ₩27,120.90
₪185.81
List Price:  ₪260.15
You save:  ₪74.34
₱2,852.60
List Price:  ₱3,993.87
You save:  ₱1,141.27
¥7,651.71
List Price:  ¥10,713.01
You save:  ¥3,061.30
MX$848.33
List Price:  MX$1,187.73
You save:  MX$339.40
QR182.01
List Price:  QR254.83
You save:  QR72.82
P679.12
List Price:  P950.82
You save:  P271.70
KSh6,605.16
List Price:  KSh9,247.76
You save:  KSh2,642.59
E£2,394.23
List Price:  E£3,352.12
You save:  E£957.88
ብር2,861.57
List Price:  ብር4,006.43
You save:  ብር1,144.85
Kz41,791.64
List Price:  Kz58,511.64
You save:  Kz16,720
CLP$47,104.79
List Price:  CLP$65,950.47
You save:  CLP$18,845.68
CN¥361.79
List Price:  CN¥506.53
You save:  CN¥144.74
RD$2,896.80
List Price:  RD$4,055.76
You save:  RD$1,158.95
DA6,728.30
List Price:  DA9,420.16
You save:  DA2,691.86
FJ$112.64
List Price:  FJ$157.70
You save:  FJ$45.06
Q387.49
List Price:  Q542.52
You save:  Q155.02
GY$10,429.06
List Price:  GY$14,601.52
You save:  GY$4,172.46
ISK kr6,980.60
List Price:  ISK kr9,773.40
You save:  ISK kr2,792.80
DH502.81
List Price:  DH703.98
You save:  DH201.16
L883.05
List Price:  L1,236.34
You save:  L353.29
ден2,855.74
List Price:  ден3,998.26
You save:  ден1,142.52
MOP$401.24
List Price:  MOP$561.77
You save:  MOP$160.53
N$922.79
List Price:  N$1,291.99
You save:  N$369.19
C$1,835.15
List Price:  C$2,569.36
You save:  C$734.20
रु6,656.11
List Price:  रु9,319.09
You save:  रु2,662.97
S/186.09
List Price:  S/260.54
You save:  S/74.45
K192.70
List Price:  K269.79
You save:  K77.09
SAR187.48
List Price:  SAR262.50
You save:  SAR75.01
ZK1,344.69
List Price:  ZK1,882.68
You save:  ZK537.98
L230.99
List Price:  L323.40
You save:  L92.41
Kč1,163.34
List Price:  Kč1,628.77
You save:  Kč465.43
Ft18,094.88
List Price:  Ft25,334.28
You save:  Ft7,239.40
SEK kr539.27
List Price:  SEK kr755.02
You save:  SEK kr215.75
ARS$43,903.33
List Price:  ARS$61,468.17
You save:  ARS$17,564.84
Bs345.22
List Price:  Bs483.33
You save:  Bs138.11
COP$194,164.52
List Price:  COP$271,845.87
You save:  COP$77,681.34
₡25,478.72
List Price:  ₡35,672.25
You save:  ₡10,193.53
L1,231.47
List Price:  L1,724.16
You save:  L492.69
₲373,200.63
List Price:  ₲522,510.75
You save:  ₲149,310.11
$U1,910.59
List Price:  $U2,674.97
You save:  $U764.38
zł200.97
List Price:  zł281.37
You save:  zł80.40
Already have an account? Log In

Transcript

Hello guys, welcome to the seventh session of using Microsoft both framework Lewis and cognitive services tutorials for beginners. In this session we will learn about how to create dialogues using dialogue chain. Dialogue class is defined in Microsoft dot both dot builder dot dialogues namespace. It provides a fluent chainable interface for dialogues. By using either dialogue stack call and AI dialogue, stack dot done, you can explicitly manage the stack of active dialogues. And by using these fluent chain methods, you can also implicitly manage the state of active dialogues.

Includes following methods select select many and where methods are similar to link methods. From method is used to create a new dialogue. Return method creates dialogue that returns to a constant value. Do method execute a side effect after a dialogue completes when the antecedent dialogue has completed and you want to execute the continuation to produce the next dialog to make change, you need to use continue with method. When the antecedent dialog completes and you want to unwrap the result into a new dialog you need to use unwrap method. When the antecedent dialog has completed and you want to stop the propagation of exception, you need to use default exception method.

Loop method will loop the entire chain of dialogues forever. Fold method will fold items from an enumeration of dialogues. Using switch method, we can create branching for creating different dialogues based on conditions. force to user method will post to the result of a dialogue to user way to both method will post message to the boat after the antecedent complex post to chain method. post a message from The user to change in this session we will see some of those methods only you can try other methods. So, that is switch to Visual Studio.

In this example, I will create same behavior of both that we have created in previous session. That is hello welcome How are you fine as always, but in this example, I will use chain to create dialogue. For these let's create a new class under dialogue folder name Hello, chain dialogue. First of all, I am going to add some namespaces that is Microsoft dot vote dot builder, Microsoft dot bowl dot builder dialogue system dot threading dot tasks system dot text dot regular expressions. In previous session we have extended our class from a dialog interface. In this session we will create property of Type II dialog for That right public static read only dialogue of string dialogue equal to chain dot post to chain method.

Select method. Here we need to specify on which property we will perform operation, we will perform operation on text off message activity create a switch case using switch method. To create a case we need to write chain dot case method which takes two parameters. First is regular expression on which you want to perform action. For that, the right new regex starts with hello and which will perform operation regardless K. Second is contextual selector in which we will get context and text. Based on that, we will return to the text message using chain dot written method.

Here, I'm going to read Welcome to vote application. After creating this, we need to post it to user for this right post to user method. Our first case was created, let is copied and paste it two more times. Now when user type How are you? We need to return I'm fine as always. And if user types anything other than to, it will be passed to default case.

For that, the right default string is dialogue of string. And return I'm unable to understood you. After this, we need to unwrap this dialog to user by using unwrapped method. Here we have created dialogue using dialogue chain. Now we need to update message controller for that opening. Instead of creating new dialog we need to pass the property that we have created.

So right dialogue dot Hello chain dialogue dialogue, save all files and run the project and open both emulator, click on Start new conversation and sent Hello. Here we got Welcome to both application and now sent How are you and we got I'm fine as always, let us see what we have learned in this session. Here are some static methods of chain class that used to create dialogues. Here I have just used select method for each method, post to user method, case method, default method and unwrap method only. But I suggest you to try all these stayed here. Here is a dialog that we have created, first of all, called a post to chain method then Try property on which operation will be performed using select method, then right switch and create two different cases and also create default case.

At the end, we have unwrapped it to user. In message controller, we need to pass static property that we have created. Thank you for watching this video. If you have any doubts, please feel free to contact me Have a nice day.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.