Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Text;
  4. using System.Threading.Tasks;
  5. using System.Net;
  6. using System.Net.Http;
  7. using Newtonsoft.Json;
  8. using Newtonsoft.Json.Linq;
  9.  
  10. namespace Alarm
  11. {
  12.     class Program
  13.     {
  14.         static void Main(string[] args)
  15.         {
  16.             DateTime timeNow = DateTime.Now;
  17.             while(true)
  18.             {
  19.               if(timeNow.Hour.ToString() + timeNow.Minute.ToString() == "2245")
  20.               {
  21.                 Req();
  22.                 Console.WriteLine("Done");
  23.                 break;
  24.               }
  25.             }
  26.  
  27.         }
  28.  
  29.         static async void Req()
  30.         {
  31.  
  32.           using (var httpClient = new HttpClient())
  33.           {
  34.             using (var request = new HttpRequestMessage(new HttpMethod("POST"), "http://192.168.0.247/1/off"))
  35.             {
  36.                 var response = await httpClient.SendAsync(request);
  37.             }
  38.           }
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement