Exemplo n.º 1
0
        private void PutTKM()
        {
            textBox1.Invoke(new Action(() => textBox1.AppendText("\r\nTakımlar\r\n")));

            if (wsTkm.ReadyState != WebSocketState.Open)
            {
                wsTkm.Connect();
            }

            if (wsTkm.ReadyState == WebSocketState.Open)
            {
                int nor = tkmTableAdapter.FillByStu(this.ds.TKM);
                TkmSay = nor;

                foreach (DataSet1.TKMRow row in ds.TKM.Rows)
                {
                    var obj = new Tkm();
                    obj.NOR = nor--;

                    obj.ID  = row.ID;
                    obj.Stu = row.STU;
                    obj.Ad  = row.AD;

                    string output = JsonConvert.SerializeObject(obj);
                    wsTkm.Send(output);
                }
            }
            else
            {
                textBox1.AppendText("--X\r\n");
            }
        }
Exemplo n.º 2
0
        private void deneme()
        {
            //HttpRequestMessage rm = new HttpRequestMessage(HttpMethod.Put, "");
            //client.SendAsync(rm, HttpCompletionOption.ResponseContentRead);

            var obj = new Tkm();

            obj.NOR = 1;
            obj.ID  = 123;
            obj.Stu = "P";
            obj.Ad  = "CanCan";

            for (int i = 0; i < 100; i++)
            {
                obj.NOR = i;
                string output   = JsonConvert.SerializeObject(obj);
                var    response = client.PostAsync("http://rest.masatenisi.online/Tkm",
                                                   new StringContent(output, Encoding.UTF8, "application/json")).Result;

                var data = response.Content.ReadAsStringAsync().Result;
                Tkm d    = JsonConvert.DeserializeObject <Tkm>(data);

                textBox1.AppendText($"--Kayıt sayısı: {d.NOR}\r\n");
            }
        }
Exemplo n.º 3
0
        private void wsTkm_OnMessage(object sender, MessageEventArgs e)
        {
            Tkm d = JsonConvert.DeserializeObject <Tkm>(e.Data);

            queriesTableAdapter.MDF_TKM(d.PutGet, d.NewID, d.ID, d.Stu, d.Ad);
            textBox1.Invoke(new Action(() => textBox1.AppendText($"Tkm: {d.PutGet} -> {d.NOR} {d.ID}\r\n")));

            TkmSay--;
        }
Exemplo n.º 4
0
        private void GetTKM()
        {
            textBox1.Invoke(new Action(() => textBox1.AppendText("\r\nTakmlar\r\n")));

            if (wsTkm.ReadyState != WebSocketState.Open)
            {
                wsTkm.Connect();
            }

            if (wsTkm.ReadyState == WebSocketState.Open)
            {
                var obj = new Tkm();
                obj.PutGet = "G";
                string output = JsonConvert.SerializeObject(obj);
                if (GetTkmSay() > 0)
                {
                    wsTkm.Send(output);
                }
            }
            else
            {
                textBox1.Invoke(new Action(() => textBox1.AppendText("\r\nNo Connection\r\n")));
            }
        }