Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Messaging Centre with Method

$
0
0

Hi Techie,
How to call method inside the messaging center with returning parameter.

 private async void BtnRegistration_Clicked(object sender, EventArgs e)
        {
            string image = "Deafult.jpeg";
            MessagingCenter.Subscribe<App, List<Model>>(App.Current, "OneMessage", async (snd, arg) =>
             {
                 Model model = arg.FirstOrDefault<Model>();
                 txtName.Text = model.Group_Name;
                 image = model.ImagePath;
                    var accessToken = Settings.AccessToken;
            var client = new HttpClient();
            string Groupname = txtName.Text;


            var json = JsonConvert.SerializeObject(models);
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
                 "Bearer", accessToken);

            HttpContent content = new StringContent(json);
            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            var response =await client.PostAsync("API CALL ", content);


             });


            BtnRegistration.IsEnabled = true;
        }

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>