-
Notifications
You must be signed in to change notification settings - Fork 0
/
FetchMessages.cs
40 lines (33 loc) · 1.06 KB
/
FetchMessages.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net.Http;
using Newtonsoft.Json;
using System.Threading;
namespace chat
{
public class FetchMessages
{
public static void Messages()
{
while (Program.username != "")
{
var values = new Dictionary<string, string>
{
{ "method", "getmessages" },
{ "key", Program.publicKey },
{ "username", Program.username },
{ "usersecret", Program.secret }
};
JsonHandler jsonHandler = new JsonHandler();
string request = JsonConvert.SerializeObject(values);
Uri url = new Uri("http://109.192.39.111:1337/chat");
string response = jsonHandler.Post(url, request);
ChatForm.openChatForm.AddText(response);
Thread.Sleep(1000);
}
}
}
}