2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-12-15 20:34:58 +01:00

Winforms overhal in progress

This commit is contained in:
Xjph
2023-05-05 09:37:08 -02:30
parent fa6966cff0
commit 7b6d345cbb
50 changed files with 5871 additions and 2680 deletions

View File

@@ -0,0 +1,36 @@
using System;
using System.Net.Http;
namespace Observatory.Utils
{
public sealed class HttpClient
{
private HttpClient()
{ }
private static readonly Lazy<System.Net.Http.HttpClient> lazy = new Lazy<System.Net.Http.HttpClient>(() => new System.Net.Http.HttpClient());
public static System.Net.Http.HttpClient Client
{
get
{
return lazy.Value;
}
}
public static string GetString(string url)
{
return lazy.Value.GetStringAsync(url).Result;
}
public static HttpResponseMessage SendRequest(HttpRequestMessage request)
{
return lazy.Value.SendAsync(request).Result;
}
public static Task<HttpResponseMessage> SendRequestAsync(HttpRequestMessage request)
{
return lazy.Value.SendAsync(request);
}
}
}