Chaged colors

Added handelrs for networking exceptions
Made Book selector a bit bigger
Fixed issue with publishing date
This commit is contained in:
2025-02-04 09:03:10 +01:00
parent 13c26eb3d8
commit 3c44c8dc8a
8 changed files with 84 additions and 38 deletions

View File

@@ -5,17 +5,25 @@ namespace Bokhantarare;
public class Helper
{
public static string Request(string requestUrl)
public static string? Request(string requestUrl)
{
HttpClient client = new HttpClient();
HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, requestUrl);
requestMessage.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json"));
try
{
HttpClient client = new HttpClient();
HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, requestUrl);
requestMessage.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json"));
//Connect to the URL
HttpResponseMessage response = client.SendAsync(requestMessage).Result;
//Connect to the URL
HttpResponseMessage response = client.SendAsync(requestMessage).Result;
// Get the response
string Output = response.Content.ReadAsStringAsync().Result;
return Output;
// Get the response
string Output = response.Content.ReadAsStringAsync().Result;
return Output;
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
return null;
}
}
}