async void ChatSubmit_Click(object sender, EventArgs e) { items.Add(ChatTxt.Text); ChatByAdapter adapter = new ChatByAdapter(this, items, "me", null, null); ChatList.Adapter = adapter; ChatList.NotifyAll(); LoadReply(ChatTxt.Text); ChatTxt.Text = ""; }
async void LoadReply(string msg) { var res = await DataServices.GetResponse("6", msg); if (res.data != null) { if (res.type == "p") { var addc = (string)res.data; ChatByAdapter adapter = new ChatByAdapter(this, items, "they", null, addc); ChatList.Adapter = adapter; ChatList.NotifyAll(); } else { var addc = (ArticleData)res.data; ChatByAdapter adapter = new ChatByAdapter(this, items, "news", addc.articles, null); ChatList.Adapter = adapter; ChatList.NotifyAll(); } } }