Created
May 26, 2018 15:23
-
-
Save icebeam7/fb4e05a1f33bb935dc0171fd999a20c0 to your computer and use it in GitHub Desktop.
XamarinFaceBot: PaginaBot.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.ObjectModel; | |
using Xamarin.Forms; | |
using Xamarin.Forms.Xaml; | |
using XamarinFaceBot.Helpers; | |
using XamarinFaceBot.Modelos; | |
using XamarinFaceBot.Servicios; | |
namespace XamarinFaceBot.Paginas | |
{ | |
[XamlCompilation(XamlCompilationOptions.Compile)] | |
public partial class PaginaBot : ContentPage | |
{ | |
ServicioBotDirectLine bot; | |
ObservableCollection<Mensaje> listaMensajes; | |
public PaginaBot () | |
{ | |
InitializeComponent (); | |
bot = new ServicioBotDirectLine(Constantes.BotUser); | |
listaMensajes = new ObservableCollection<Mensaje>(); | |
lsvMensajes.ItemsSource = listaMensajes; | |
bot.ObtenerMensajes(listaMensajes); | |
} | |
public void btnEnviar_Clicked(object sender, EventArgs e) | |
{ | |
var texto = txtMensaje.Text; | |
if (texto.Length > 0) | |
{ | |
txtMensaje.Text = ""; | |
var mensaje = new Mensaje(texto, bot.Cuenta.Name); | |
listaMensajes.Add(mensaje); | |
bot.EnviarMensaje(texto); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment