private void ConversationRefreshComplete(object sender, UploadValuesCompletedEventArgs e) { mClient.UploadValuesCompleted -= ConversationRefreshComplete; if (e.Result == null) { ServiceException(); return; } string data = Encoding.UTF8.GetString(e.Result); Console.WriteLine(data); List <RootObject> obj = JsonConvert.DeserializeObject <List <RootObject> >(data); AssignMessages(obj); ListView messageListView = FindViewById <ListView>(Resource.Id.messageListView); Console.WriteLine("LIST POS: " + currentContact.ListPosition); //Console.WriteLine(LoggedUser.ContactList[currentContact.ListPosition].messageList[0].message); MessageAdapter adapter = new MessageAdapter(this, LoggedUser.ContactList[currentContact.ListPosition].messageList); messageListView.Adapter = adapter; messageListView.SetSelection(adapter.Count - 1); TextView messageInput = FindViewById <TextView>(Resource.Id.MessageInput); messageInput.Text = ""; SendButton.Enabled = true; RefreshButton.Enabled = true; BackButton.Enabled = true; MessengerLoader.Visibility = ViewStates.Invisible; }
private void List_ItemClick(object sender, AdapterView.ItemClickEventArgs e) { Console.WriteLine(e.Position); SetContentView(Resource.Layout.Messenger); SendButton = FindViewById <ImageButton>(Resource.Id.SendButton); SendButton.Click += SendButton_Click; BackButton = FindViewById <ImageButton>(Resource.Id.BackButton); BackButton.Click += SwitchToContacts_Button; ListView messageListView = FindViewById <ListView>(Resource.Id.messageListView); TextView contactTitle = FindViewById <TextView>(Resource.Id.contactNameHeader); contactTitle.Text = LoggedUser.ContactList[e.Position].Username; if (LoggedUser.ContactList[e.Position].messageList == null) { LoggedUser.ContactList[e.Position].messageList = new List <MessageObject>(); } LoggedUser.ContactList[e.Position].ListPosition = e.Position; MessageAdapter adapter = new MessageAdapter(this, LoggedUser.ContactList[e.Position].messageList); messageListView.Adapter = adapter; messageListView.SetSelection(adapter.Count - 1); DbContact newContact = new DbContact(); newContact.Username = LoggedUser.ContactList[e.Position].Username; newContact.Id = LoggedUser.ContactList[e.Position].Id; currentContact = LoggedUser.ContactList[e.Position]; currentContactPosition = e.Position; RefreshButton = FindViewById <ImageButton>(Resource.Id.RefreshButton); RefreshButton.Click += RefreshButton_Click; MessengerLoader = FindViewById <ProgressBar>(Resource.Id.MessengerLoader); }