Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement