Beispiel #1
0
        public ChatbotPageViewModel()
        {
            Messages.Insert(0, ChatbotResponseHelper.GetWelcomeMessage());

            MessageAppearingCommand    = new Command <ChatbotMessage>(OnMessageAppearing);
            MessageDisappearingCommand = new Command <ChatbotMessage>(OnMessageDisappearing);

            shipmentTrackingService = new ShipmentTrackingService();
        }
Beispiel #2
0
        public static async Task <ChatbotMessage> ProcessIntent()
        {
            var answer     = "Sorry, I couldn't get you.";
            var intentName = ResolvedIntent.IntentName;

            var responseObj = new ChatbotMessage()
            {
                Text          = answer,
                IsBotResponse = true
            };

            if (intentName.Equals("HELLO"))
            {
                responseObj = ChatbotResponseHelper.HelloIntentResponse();
            }
            else if (intentName.Equals("NONE"))
            {
                responseObj = ChatbotResponseHelper.NoneIntentResponse();
            }
            else if (intentName.Equals("BYE"))
            {
                responseObj = ChatbotResponseHelper.ByeIntentResponse();
            }
            else if (intentName.StartsWith("HELP_"))
            {
                responseObj = ChatbotResponseHelper.HelpIntentResponse(intentName);
            }
            else if (intentName.StartsWith("SEARCH_"))
            {
                if (!string.IsNullOrEmpty(ResolvedIntent.InputParameter.MetroRefNumber))
                {
                    var metroRefNum = ResolvedIntent.InputParameter.MetroRefNumber;
                    Debug.WriteLine("----------------Metro ref number: " + metroRefNum);

                    responseObj = await ChatbotResponseHelper.SearchIntentResponse(intentName, metroRefNum);
                }
                else if (!string.IsNullOrEmpty(ResolvedIntent.InputParameter.ContainerNumber))
                {
                    var containerNum = ResolvedIntent.InputParameter.ContainerNumber;
                    Debug.WriteLine("----------------Container number: " + containerNum);

                    responseObj = await ChatbotResponseHelper.SearchIntentResponse(intentName, containerNum);
                }
                else if (!string.IsNullOrEmpty(ResolvedIntent.InputParameter.CustomerRefNumber))
                {
                    var customerRefNum = ResolvedIntent.InputParameter.CustomerRefNumber;
                    Debug.WriteLine("----------------Customer ref number: " + customerRefNum);

                    responseObj = await ChatbotResponseHelper.SearchIntentResponse(intentName, customerRefNum);
                }
            }

            return(responseObj);
        }