Пример #1
0
        private void wsTrnOyn_OnMessage(object sender, MessageEventArgs e)
        {
            TrnOyn d = JsonConvert.DeserializeObject <TrnOyn>(e.Data);

            queriesTableAdapter.MDF_TRNOYN(d.PutGet, d.NewID, d.ID, d.Stu, d.TrnID, d.OynID, d.SrtNo, d.MacOS, d.MacAS, d.MacVS, d.MacOD, d.MacAD, d.MacVD);
            textBox1.Invoke(new Action(() => textBox1.AppendText($"TrnOyn: {d.PutGet} -> {d.NOR} {d.ID}\r\n")));

            TrnOynSay--;
        }
Пример #2
0
        private void PutTRNOYN(long TrnID)
        {
            textBox1.Invoke(new Action(() => textBox1.AppendText("\r\nTurnuva Oyuncuları\r\n")));

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

            if (wsTrnOyn.ReadyState == WebSocketState.Open)
            {
                int nor = 0;
                if (TrnID == 0)
                {
                    nor = trnoynTableAdapter.FillByStu(this.ds.TRNOYN);
                }
                else
                {
                    nor = trnoynTableAdapter.FillByTrnStu(this.ds.TRNOYN, TrnID);
                }

                TrnOynSay = nor;

                foreach (DataSet1.TRNOYNRow row in ds.TRNOYN.Rows)
                {
                    var obj = new TrnOyn();
                    obj.NOR = nor--;

                    obj.ID    = row.ID;
                    obj.Stu   = row.STU;
                    obj.TrnID = row.TRNID;
                    obj.OynID = row.OYNID;

                    obj.MacOS = row.IsMACOSNull() ? (short)0 : row.MACOS;
                    obj.MacAS = row.IsMACASNull() ? (short)0 : row.MACAS;
                    obj.MacVS = row.IsMACVSNull() ? (short)0 : row.MACVS;
                    obj.MacOD = row.IsMACODNull() ? (short)0 : row.MACOD;
                    obj.MacAD = row.IsMACADNull() ? (short)0 : row.MACAD;
                    obj.MacVD = row.IsMACVDNull() ? (short)0 : row.MACVD;

                    string output = JsonConvert.SerializeObject(obj);
                    wsTrnOyn.Send(output);
                }
            }
            else
            {
                textBox1.AppendText("--X\r\n");
            }
        }
Пример #3
0
        private void GetTRNOYN()
        {
            textBox1.Invoke(new Action(() => textBox1.AppendText("\r\nTurnuva Oyuncuları\r\n")));

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

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