Program.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using Avalonia;
  2. using Avalonia.ReactiveUI;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Net.Http;
  6. using System.Net.Http.Headers;
  7. using System.Threading.Tasks;
  8. using Newtonsoft.Json;
  9. namespace Avalonia.UI
  10. {
  11. /*
  12. class WantedPersons
  13. {
  14. public string title { get; set; }
  15. public char dates_of_birth_used { get; set; }
  16. public string nationality { get; set; }
  17. public string race_raw { get; set; }
  18. public string race { get; set; }
  19. public string hair_raw { get; set; }
  20. public string place_of_birth { get; set; }
  21. public string person_classification { get; set; }
  22. public string description { get; set; }
  23. public int height_max { get; set; }
  24. public int height_min { get; set; }
  25. public override string ToString()
  26. {
  27. return $"{title}: {dates_of_birth_used}: {nationality} nationality: {race_raw}:" +
  28. $" {race}: {hair_raw}: {place_of_birth}: {person_classification}: {description}:" +
  29. $"{height_max}: {height_min}";
  30. }
  31. */
  32. class Program
  33. {
  34. [STAThread]
  35. public static void Main(string[] args)
  36. {
  37. /*
  38. using var client = new HttpClient();
  39. client.BaseAddress = new Uri("https://www.fbi.gov/wanted");
  40. client.DefaultRequestHeaders.Add("MostWanted Persons", "");
  41. client.DefaultRequestHeaders.Accept.Add(
  42. new MediaTypeWithQualityHeaderValue("application/json"));
  43. var url = "repos/symfony/symfony/persons";
  44. HttpResponseMessage response = await client.GetAsync(url);
  45. response.EnsureSuccessStatusCode();
  46. var resp = await response.Content.ReadAsStringAsync();
  47. List<WantedPersons> persons = JsonConvert.DeserializeObject<List<WantedPersons>>(resp);
  48. */
  49. BuildAvaloniaApp()
  50. .StartWithClassicDesktopLifetime(args);
  51. }
  52. public static AppBuilder BuildAvaloniaApp()
  53. => AppBuilder.Configure<App>()
  54. .UsePlatformDetect()
  55. .LogToTrace()
  56. .UseReactiveUI();
  57. }
  58. }