Beispiel #1
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            var cnt = BindingContext as contact;

            if (cnt.FirstName == null)
            {
                await DisplayAlert("Alert", "Firstname should not be empty", "ok");

                return;
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(cnt.Id.ToString()))
                {
                    //await DisplayAlert("Alert", cnt.FirstName, "ok");
                    cnt.Id = 1;
                    ContactAdded?.Invoke(this, cnt);
                    await Navigation.PopModalAsync();
                }
                else
                {
                    //await DisplayAlert("new", cnt.FirstName, "ok");

                    ContactUpdate?.Invoke(this, cnt);
                    await Navigation.PopModalAsync();
                }
            }
        }
Beispiel #2
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            var contact = BindingContext as ContactEj;

            if (String.IsNullOrWhiteSpace(contact.FirstName))
            {
                await DisplayAlert("Error", "Por favor ingrese el nombre.", "OK");

                return;
            }

            if (contact.Id > 0)
            {
                ContactUpdate.Invoke(this, contact);
            }
            else
            {
                ContactAdded.Invoke(this, contact);
            }
        }
Beispiel #3
0
        async private void saveBtn_Clicked(object sender, EventArgs e)
        {
            var contact = BindingContext as Contact;

            if (string.IsNullOrEmpty(contact.FirstName) && string.IsNullOrEmpty(contact.LastName))
            {
                await DisplayAlert("Validation failed", "Please enter the name", "OK");
            }
            else
            {
                if (contact.Id == null)
                {
                    ContactAdd?.Invoke(this, contact);
                }
                else
                {
                    ContactUpdate?.Invoke(this, contact);
                }
                await Navigation.PopAsync();
            }
        }