Exemplo n.º 1
0
 private void mClient_DownloadDailySermon(object sender, DownloadDataCompletedEventArgs e)
 {
     RunOnUiThread(() =>
     {
         string json            = Encoding.UTF8.GetString(e.Result);
         mDailySermon           = JsonConvert.DeserializeObject <Sermon>(json);
         mDailySermonButton     = FindViewById <Button>(Resource.Id.sermon);
         mDailySermonButton.Tag = mDailySermon.ID.ToString();
     });
 }
        async void PostRequest(string URL, string sermonID)
        {
            var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("SermonID", sermonID),
            });

            var myHttpClient = new HttpClient();
            var response     = await myHttpClient.PostAsync(URL, formContent);

            string json = await response.Content.ReadAsStringAsync();

            mSermon = JsonConvert.DeserializeObject <Sermon>(json);


            mSermonContent.LoadUrl(mSermon.Text);
            this.Title = mSermon.Title;

            if (mSermon.Image != null)
            {
                Picasso.With(this).Load(mSermon.Image).Into(FindViewById <ImageView>(Resource.Id.sermonTitle));
            }
        }