public MainPage() { InitializeComponent(); var assembly = typeof(MainPage).GetTypeInfo().Assembly; imgLogo.Source = ImageSource.FromResource($"{assembly.GetName().Name}.Model.Imagens.logo.png"); Sons.carregarSons(); Sons.intro.Play(); lstPergunta = new Repositorio().LerJson(); }
public ListaPerguntas LerJson() { var assembly = typeof(MainPage).GetTypeInfo().Assembly; ListaPerguntas PerguntaList = new ListaPerguntas(); Stream stream = assembly.GetManifestResourceStream($"{assembly.GetName().Name}.Model.Perguntas.dados.json"); using (var reader = new System.IO.StreamReader(stream)) { var jsonString = reader.ReadToEnd(); //Convert Objetos JSON para uma lista generica PerguntaList = JsonConvert.DeserializeObject <ListaPerguntas>(jsonString); } return(PerguntaList); }