SHARE
TWEET

Untitled

a guest Jul 23rd, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using RestSharp;
  11.  
  12. namespace carte_adino
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.  
  22.         private void Send_Click(object sender, EventArgs e)
  23.         {
  24.             if (URL_Input.Text == String.Empty)
  25.             {
  26.                MessageBox.Show("Veuillez entrer un URL VALIDE.");
  27.                 return;
  28.             }
  29.  
  30.  
  31.             SetLedState(URL_Input.Text, ledNumber, ledState);
  32.  
  33.  
  34.  
  35.  
  36.  
  37.         }
  38.         private string SetLedState(string url, int ledNumber, int ledState)
  39.         {
  40.             RestClient client = new RestClient(url);
  41.  
  42.             RestRequest request = new RestRequest();
  43.             request.Method = Method.POST;
  44.             request.AddParameter("Data", $"{ledNumber},{ledState}");
  45.  
  46.             IRestResponse response = client.Execute(request);
  47.             return response.Content;
  48.         }
  49.     }
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top