示例#1
0
        async Task LoadMain()
        {
            await Task.Run(async() =>
            {
                var data = await InboxService.GetMessages(App.userFB.id);

                Console.WriteLine("OK listas");
                Device.BeginInvokeOnMainThread(() =>
                {
                    if (data != null)
                    {
                        listInbox.ItemsSource = data;
                    }
                    Loading(false);
                });
            });
        }
示例#2
0
        public async void EliminarMensaje(string id)
        {
            Console.WriteLine("entra a registrar");


            try
            {
                var responseApi = await InboxService.DeleteMessage(id);


                Device.BeginInvokeOnMainThread(async() =>
                {
                    if (responseApi != null)
                    {
                        if (responseApi["codigo"].ToString() == "1")
                        {
                            var s = responseApi["data"].ToString();
                            LoadMain();
                        }
                        else
                        {
                            Loading(false);
                            await DisplayAlert("Inbox", responseApi["mensaje"].ToString(), "Aceptar");
                        }
                    }
                    else
                    {
                        Loading(false);
                        await DisplayAlert("Inbox", "Ha ocurrido un error.", "Aceptar");
                    }
                });
            }
            catch (Exception e)
            {
                Loading(false);
                Console.WriteLine("ha ocurrido un error");
            }
        }