Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            timer3.Stop();
            AtsRequest AtsReq = new AtsRequest();
            int        res    = AtsReq.AtsPutPauseRequest(label5.Text, "d2lkZ2V0cGFzc3dvcmQ");

            if (res == 1)
            {
                operStatus.ForeColor = Color.Green;
                operStatus.Text      = "Встал на паузу!";
            }
            else
            {
                operStatus.ForeColor = Color.Red;
                operStatus.Text      = "Неудача X_X";
            }
            timer3.Start();
        }
Ejemplo n.º 2
0
        public int AtsPutPauseRequest(string opernum, string token)
        {
            HttpClient hClient = new HttpClient();
            AtsRequest putreq  = new AtsRequest
            {
                Operator = opernum,
                token    = token
            };


            //String json = JsonConvert.SerializeObject(putreq, Formatting.Indented);
            hClient.BaseAddress = new Uri("http://192.168.10.5:8070/");
            var response = hClient.PutAsJsonAsync("widget/operator/pause", putreq).Result;

            //bool returnValue2 = response.Content.ReadAsAsync<bool>().Result;
            if (response.IsSuccessStatusCode)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }