예제 #1
0
        public void login(string url,user user,string username, string password)
        {
            Dictionary<string, string> param = new Dictionary<string, string> { { "username", username }, { "password", password } };
            var json = getResponse(url + "/xml/checklogin", param);
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            Dictionary<string, object> response = (Dictionary<string, object>)serializer.DeserializeObject(json);
            if ((bool)response.FirstOrDefault().Value)
            {
                user.setLogged(username,password);

            }else{ throw new Exception("Could not login");}
        }
예제 #2
0
        public void loadData(user userlogin)
        {
            this.user = userlogin;
            chat chatserv = new chat();

            try
            {
                chatserv.getListChat("http://support.ekecompany.com/index.php", this.user, this.user.username, this.user.pass);

            }
            catch (Exception exception)
            {

            }
        }
예제 #3
0
        public void getListChat(string url, user user, string username, string password)
        {
            Dictionary<string, string> param = new Dictionary<string, string> { { "username", username }, { "password", password } };
            var json = getResponse(url + "/xml/lists", param);
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            Dictionary<string, object> response = (Dictionary<string, object>)serializer.DeserializeObject(json);
            Dictionary<string, object> rows = (Dictionary<string, object>)((Dictionary<string, object>)response["active_chats"])["rows"];
            foreach(var row in rows){
                string temp = serializer.Serialize(row.Value);
                Conversationchat activechat = serializer.Deserialize<Conversationchat>(temp);
            }
            //Dictionary<string, string> response2 = serializer.Deserialize<Dictionary<string, string>>(response1["active_chats"]);
            //Dictionary<string, string> response3 = serializer.Deserialize<Dictionary<string, string>>(response1["rows"]);

            //serializer.Serialize(response3);

                //Conversationchat activechat = serializer.Deserialize<Conversationchat>(a);
        }