Пример #1
0
        async void btnSave_Clicked(System.Object sender, System.EventArgs e)
        {
            bool isgood = false;

            if (txtEmail.Text != null)
            {
                if (txtEmail.Text.Trim().Length > 7)
                {
                    if (txtEmail.Text.Contains("@") && txtEmail.Text.Contains("."))
                    {
                        isgood = true;
                    }

                    if (isgood)
                    {
                        contact.Email = txtEmail.Text;
                        contact.Name  = txtName.Text;
                        if (bAddNew)
                        {
                            bool addednew = contact.AddItem(contact);
                        }
                        else
                        {
                            bool added = await contact.UpdateItem(contact);
                        }
                        BindData();
                        await FadeDetailOut();
                    }
                }
            }
            if (!isgood)
            {
                await DisplayAlert("Error", "Email is not valid", "Ok");
            }
        }
Пример #2
0
        void btnSaveRecipient_Clicked(System.Object sender, System.EventArgs e)
        {
            Models.Contact c = new Models.Contact();
            c.Email = payment.Email;
            bool bSaved = c.AddItem(c);

            if (bSaved)
            {
                lblMessage.Text      = payment.Email + " has been added to your AnyPal contacts.";
                lblMessage.TextColor = Color.Green;
            }
            else
            {
                lblMessage.Text      = "Sorry, " + payment.Email + " could not be added to your AnyPal contacts.";
                lblMessage.TextColor = Color.Red;
            }
        }
Пример #3
0
        async void btnNewContact_Clicked(System.Object sender, System.EventArgs e)
        {
            Models.Contact c = new Models.Contact();
            c.Email = txtEmail.Text;
            c.Name  = txtItemName.Text;
            bool bSaved = c.AddItem(c);

            if (bSaved)
            {
                ContactEnum = await c.GetContacts();
                await DisplayAlert("Success", "Your contact has been saved.", "Ok");
            }
            else
            {
                await DisplayAlert("Error", "Sorry, your contact could not saved.", "Ok");
            }
            ClearForm();
            frmAddContact.IsVisible = false;
            frmPayment.IsVisible    = true;
        }