public void LoginMethod() { if (!string.IsNullOrEmpty(Username)) { LoginVisibility = Visibility.Collapsed; ChatViewVisibility = Visibility.Visible; server.Join(Username); var history = server.GetChats(); Messages = new ObservableCollection <Message>(history); server.RefreshAsync(); } }
public ActionResult GetMessages(string chatType) { try { ChatServiceClient client = new ChatServiceClient(chatType); var type = (ChatType) Enum.Parse(typeof (ChatType), chatType); var result = client.GetChats(type).ToList(); return Json(new WcfResult("Recieved messages", true, result), JsonRequestBehavior.AllowGet); } catch (FaultException ex) { return Json(new WcfResult(ex.Message,false), JsonRequestBehavior.AllowGet); } catch (Exception ex) { return Json(new WcfResult(ex.Message, false), JsonRequestBehavior.AllowGet); } }
private List<Message> InitializeChatRoom(List<Message> messages, ChatType chatType) { client = new ChatServiceClient(chatType.ToString()); messages = client.GetChats(chatType).ToList(); currentChatType = chatType; return messages; }