private void Time_Request_Tick(object sender, EventArgs e) { if (dataMessage != "0") { ProccessData(); } ThreadStart ts_1 = new ThreadStart(threadGetData); Thread thrd_1 = new Thread(ts_1); thrd_1.Start(); if (Time_Request.Interval != App_Status.time_delay) { Time_Request.Interval = App_Status.time_delay; Time_Request.Stop(); Time_Request.Start(); } }
public void ProccessData() { Time_Request.Stop(); /*List<Data_Message> list = JsonConvert.DeserializeObject<List<Data_Message>>(dataMessage); * MessageBox.Show(list.ToString());*/ //string kkdata = @"{""data"":[{""k_userID"":""518523721"",""name"":""ftyft""}, {""k_userID"":""527032438"",""name"":""ftyftyf""}, {""k_userID"":""527572047"",""name"":""ftgft""}, {""id"":""531141884"",""name"":""ftftft""}]}"; Conversation_Message dMess = new JavaScriptSerializer().Deserialize <Conversation_Message>(dataMessage); /*for(int i = 0; i < dMess.data.Count; i++) * { * dMess.data. * }*/ for (int i = dMess.data.Count - 1; i >= 0; i--) { byte[] bytes = Encoding.Default.GetBytes(dMess.data[i].Message.ToString()); dMess.data[i].Message = Encoding.UTF8.GetString(bytes); if (Convert.ToInt32(dMess.data[i].Message_id) > messIndex) { messIndex = Convert.ToInt32(dMess.data[i].Message_id); } if (dMess.data[i].User_id == User_Info.k_ID) { addInMessage(dMess.data[i].Message.ToString(), Convert.ToInt32(dMess.data[i].Message_type.ToString()), dMess.data[i].Image.ToString(), dMess.data[i].Sticker.ToString(), dMess.data[i].Time.ToString()); } else { addOutMessage(dMess.data[i].Message.ToString(), Convert.ToInt32(dMess.data[i].Message_type.ToString()), dMess.data[i].Image.ToString(), dMess.data[i].Sticker.ToString(), dMess.data[i].Time.ToString()); } } Time_Request.Start(); dataMessage = "0"; }