Ejemplo n.º 1
0
        public async void InitializePage()
        {
            try {
                await MapsController.InstantiateNewMap(MapRegion);

                _EcoPoints = await EcoPointController.GetAllAPI();

                AddPinsToMap();
            }
            catch { await DisplayAlert("Ocorreu um erro ao tentar obter os dados do mapa!", "Tente novamente mais tarde!", "Ok"); }
        }
Ejemplo n.º 2
0
        private async void BtnAddEcoPonto_Clicked(object sender, EventArgs e)
        {
            if (!Validate())
            {
                await DisplayAlert("Ocorreu um erro!", "Revise suas informações, alguns campos não podem ser nulos.", "OK");

                return;
            }
            try {
                Eco = new EcoPoint(NameEcoPontoEntry.Text, DescritionEcoPontoEntry.Text, Materials.SelectedItems.ToList(),
                                   new Address(CepEcoPontoEntry.Text, RuaEcoPontoEntry.Text, NumberEcoPontoEntry.Text, ComplementEcoPontoEntry.Text,
                                               BairroEcoPontoEntry.Text, CityEcoPontoEntry.Text, StateEcoPontoEntry.Text), new Phone(PhoneEcoPontoEntry.Text));

                UserController.CurrentUser.EcoPoints.Add(Eco);
                CallbackStatus status = await EcoPointController.AddAPI(UserController.CurrentUser);
                await DisplayAlert($"{ status.CurrentStatus.CallbackStatusToText()}", status.CallbackMessage, "OK");
            } catch { await DisplayAlert("Ocorreu um erro ao tentar adicionar novo ecoponto!", "Tente novamente mais tarde.", "OK"); }
        }