/// <summary>
        /// Obtendo Dados da Noticias na URL
        /// </summary>
        /// <returns></returns>
        public async Task GetNoticias()
        {
            Aguarde = true;
            try
            {
                HttpClient cliente   = new HttpClient();
                var        resultado = await cliente.GetStringAsync(URL_GET_NOTICIAS);

                var restaurantesJson = JsonConvert.DeserializeObject <NoticiasJson[]>(resultado);

                Noticias.Clear();
                //LOOOP
                foreach (var restaurantes in restaurantesJson)
                {
                    Noticias.Add(new Noticias
                    {
                        NewsId     = restaurantes.newsid,
                        Title      = restaurantes.title,
                        Author     = restaurantes.author,
                        ResumeText = restaurantes.resumetext,
                        PostDate   = restaurantes.postdate,
                        Photo      = restaurantes.photo.ToString(),
                        Text       = restaurantes.text
                    });
                }
            }
            catch (Exception ex)
            {
                MessagingCenter.Send <Exception>(ex, "FalhaListagem");
            }
            Aguarde = false;
        }
示例#2
0
        public List <Noticias> ReadAll()
        {
            List <Noticias> noticia = new List <Noticias>();

            string[] linhas = File.ReadAllLines(PATH);

            foreach (var item in linhas)
            {
                string[] linha  = item.Split(";");
                Noticias equipe = new Noticias();
                Noticias.IdEquipe = Int32.Parse(linha[0]);
                Noticias.Nome     = linha[1];
                Noticias.Imagem   = linha[2];

                Noticias.Add(Noticias);
            }
            return(Noticias);
        }