public StarshipListViewModel()
 {
     Starships = new ObservableCollection <Starship>();
     SWApi.GetStarshipsAsync(starships =>
     {
         foreach (var starship in starships)
         {
             Starships.Add(starship);
         }
     });
 }
Beispiel #2
0
        static void Main()
        {
            WebClient wc = new WebClient();

            Console.WriteLine("Enter one Star Wars Character:");
            string character = Console.ReadLine();
            string url       =
                $"https://swapi.co/api/people/?search" +
                $"={character}";
            string json        = wc.DownloadString(url);
            SWApi  apiResponse =
                JsonConvert.DeserializeObject <SWApi>(json);

            foreach (Character result in apiResponse.Results)
            {
                Console.WriteLine(result.Name + " Has appeared in " + result.Films.Length + " films");
            }
            Console.ReadKey();
        }
Beispiel #3
0
 public RegistrationController()
 {
     swApi = new SWApi();
 }