Exemple #1
0
 static public string LeaveRoom(string roomID)
 {
     try
     {
         ChatRoom room = ChatEngine.GetRoom(roomID);
         if (room != null)
         {
             room.LeaveRoom(HttpContext.Current.Session["UserName"].ToString());
         }
     }
     catch (Exception ex)
     {
     }
     return("");
 }
Exemple #2
0
 static public string SendMessage(string msg, string roomID)
 {
     try
     {
         ChatRoom room = ChatEngine.GetRoom(roomID);
         string   res  = "";
         if (room != null)
         {
             res = room.SendMessage(msg, HttpContext.Current.Session["UserName"].ToString());
         }
         return(res);
     }
     catch (Exception ex)
     {
     }
     return("");
 }
Exemple #3
0
 static public string UpdateUser(string roomID)
 {
     try
     {
         ChatRoom room = ChatEngine.GetRoom(roomID);
         if (room != null)
         {
             string res = "";
             if (room != null)
             {
                 res = room.UpdateUser(HttpContext.Current.Session["UserName"].ToString());
             }
             return(res);
         }
     }
     catch (Exception ex)
     {
     }
     return("");
 }
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserName"] == null)
        {
            Response.Redirect("Default.aspx");
        }

        txtMsg.Attributes.Add("onkeypress", "return clickButton(event,'btn')");
        if (!IsPostBack)
        {
            hdnRoomID.Value = Request.QueryString["rid"];
            ChatRoom room     = ChatEngine.GetRoom(hdnRoomID.Value);
            string   prevMsgs = room.JoinRoom(Session["UserName"].ToString(), Session["UserName"].ToString());
            txt.Text = prevMsgs;
            foreach (string s in room.GetRoomUsersNames())
            {
                lstMembers.Items.Add(new ListItem(s, s));
            }
        }
    }
Exemple #5
0
    static public string UpdateRoomMembers(string roomID)
    {
        try
        {
            ChatRoom room = ChatEngine.GetRoom(roomID);
            if (room != null)
            {
                IEnumerable <string> users = room.GetRoomUsersNames();
                string res = "";

                foreach (string s in users)
                {
                    res += s + ",";
                }
                return(res);
            }
        }
        catch (Exception ex)
        {
        }
        return("");
    }