Пример #1
0
        private async void btnDeleteContact_Clicked(object sender, EventArgs e)
        {
            AmiciClient amiciClient = new AmiciClient(await Api.ApiHelper.GetApiClient());

            try
            {
                await amiciClient.AmiciziaDeleteOrDenyAsync(viewModel.Info.IdAspNetUser);

                btnConfirmDenyContact.IsVisible = true;
                btnConfirmDenyContact.IsVisible = false;
                btnSendRequest.IsVisible        = true;
                viewModel.LoadItemsCommand.Execute(null);
            }
            catch
            {
                await DisplayAlert(null,
                                   Helpers.TranslateExtension.ResMgr.Value.GetString("AmiciProfilo.ErrorGeneric", CurrentCulture.Ci),
                                   Helpers.TranslateExtension.ResMgr.Value.GetString("AmiciProfilo.Ok", CurrentCulture.Ci));
            }
        }
Пример #2
0
        async void ToolbarItem_Clicked(System.Object sender, System.EventArgs e)
        {
            string action = await DisplayActionSheet("Che cosa vuoi fare?", "Annulla", null, "Rimuovi amico");

            if (action == "Rimuovi amico")
            {
                bool answer = await DisplayAlert("Attenzione",
                                                 //Helpers.TranslateExtension.ResMgr.Value.GetString("EventoModifica.ConfirmDelete", CurrentCulture.Ci),
                                                 //Helpers.TranslateExtension.ResMgr.Value.GetString("EventoModifica.Yes", CurrentCulture.Ci),
                                                 //Helpers.TranslateExtension.ResMgr.Value.GetString("EventoModifica.No", CurrentCulture.Ci));
                                                 "Vuoi procedre con l'eliminazione?",
                                                 "Sì",
                                                 "No");

                if (answer)
                {
                    AmiciClient amiciClient = new AmiciClient(await Api.ApiHelper.GetApiClient());

                    try
                    {
                        await amiciClient.AmiciziaDeleteOrDenyAsync(viewModel.Info.IdAspNetUser);

                        btnConfirmDenyContact.IsVisible = false;
                        btnConfirmDenyContact.IsVisible = false;
                        btnSendRequest.IsVisible        = true;
                        viewModel.LoadItemsCommand.Execute(null);
                    }
                    catch
                    {
                        await DisplayAlert(null,
                                           Helpers.TranslateExtension.ResMgr.Value.GetString("AmiciProfilo.ErrorGeneric", CurrentCulture.Ci),
                                           Helpers.TranslateExtension.ResMgr.Value.GetString("AmiciProfilo.Ok", CurrentCulture.Ci));
                    }
                }
            }
        }