示例#1
0
        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();
            }
        }
示例#2
0
        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);
            }

        }
示例#3
0
 private List<Message> InitializeChatRoom(List<Message> messages, ChatType chatType)
 {
     client = new ChatServiceClient(chatType.ToString());
     messages = client.GetChats(chatType).ToList();
     currentChatType = chatType;
     return messages;
 }