Dialog: Understood and create basic Dialog

5 minutes
Share the link to this page
Copied
  Completed

Transcript

Hello guys, welcome to the sixth session of using Microsoft bought framework Louis and cognitive services tutorials for beginners. In this session we will learn about dialogues and creating a new dialogue. dialogues are used to create conversation and manage conversation flow. In a C sharp class that implements identify interface. A dialogue can be composed with other dialogues to maximize reuse. A dialogue has a context that contains a stack of dialogue, activity conversation and will maintain the state of the conversation.

A dialogue sends messages to a user and is suspended when it is waiting for a response from a user. The idi low context interface that is passed into each dialogue method provides access to the services that dialogue requires to save state and communicate with the channel. Till now, we have used good dialogue That comes by default when you are creating new boat application. Now I'm going to create a new dialog in which when users say hello, our boat will send Welcome to both application. And if it gets, how are you? It will reply.

I'm fine as always. For this, we need to create a new class under dialogue folder named welcome dialog. First of all, we need to import namespaces for both frameworks, that is using Microsoft board builder dialogues and Microsoft both connected. Each dialog must need to implement I dialog interface of type object and also create methods of this interface. Because of this dialog, it will be internally serialized and deserialized by both framework, so we need to make it as a serializable. Now we need to create a method which will perform Original operation of boat that is returning to welcome or I am find myself for these right privatising task.

Perform action acing. Here this name is chosen by me You can also use differently. This method will take two parameters. First is either look contest context and another building I have a table of type object reasons. This context object contains all my said details. First of all we need to retrieve text that is signed by user.

For these, we need to write well activity equals to await result as activity. And now we will check if activity dot txt equals to Hello. Then we need to return Welcome to boot application. For these, we need to use post a sync method of context Copy this line. And if text is How're you then we need to return it. I'm fine as always.

Otherwise, we need to send I'm unable to understood you. And now we need to call this method from start acing by using context dot weight method and return to task dot completed task. Our first dialog is created. Now we need to tell message controller that instead of through dialogue, please use welcome dialog and update it here. Save all files and run the project. Copy URL, open both emulator and paste URL.

Let us send Hello Here we got welcome message. And now I'm going to send How are you? We got fine message to let us sign any other text. Here we got. I'm unable to listen to you that is to see what we have learned in this session. First of all we need to implement it dialog interface and math class serializable.

Then create a method from which we will perform original operation. We are obtaining message that type by user and check its text to send message we need to use hostessing method of contracts. Then use context dot weight method to call method that we create and return complete tasks. 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.