Posts: 5
Joined: Tue Sep 25, 2018 5:43 pm

Loop Problem with integrating OSCOVA chatbot into Xamarin App

Mon Apr 29, 2019 11:24 pm


I have a problem with integrating an OSCOVA bot into my Xamarin chat app.
First I had a very good working SIML Classic Bot inside the app and wanted to change it to a SIML Modern/Oscova Bot (see pic1).
You can see, it's just reading the SIML package and putting the user message and the generated bot answer into speech bubbles ("Message").
After I failed to read the SIML Modern Package from the Android Assets folder, I tried to integrate some simple dialogs into C# (see pic2) and use them in the code, similar to the SIML Classic Bot code example (see pic3).
The code in pic3 works, but something strange happens: It creates a kind of stack of bot messages.

First user message : Hallo
Bot: Hi
Second user message : Hallo
Bot: Hi
Bot: Hi
Third user message : Hi
Bot: Hallo
Bot: Hallo
Bot: Hallo
Fourth user message : Hallo
Bot: Hi
Bot: Hi
Bot: Hi
Bot: Hi

The chatbot messages are simply getting more and more. Each message will be put into a new speech bubble...You can imagine that this is not very useful.
I'm guessing that this stack is created by the Chatbot.MainUser.ResponseReceived += loop ( --> ResponseReceived.Add).

Is there a way to skip this or just delete this stack every time? Or is there a very simple way to get around the problem?

It would be very kind if someone could help me. Thank you in advance!

Best regards
pic3.JPG (45.98 KiB) Viewed 1640 times
pic2.JPG (19.41 KiB) Viewed 1640 times
pic1.JPG (53.15 KiB) Viewed 1640 times

User avatar
Lead Software Architect
Posts: 375
Joined: Fri Sep 14, 2012 12:20 pm
Contact: Website

Re: Loop Problem with integrating OSCOVA chatbot into Xamarin App

Tue Oct 15, 2019 5:41 pm

You are adding a handler for MessageReceived everytime a Send command is executed. An event handler should be added only once.

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests