如何使我的电子邮件不是静态的?

时间:2017-09-19 12:09:49

标签: c# email listview xamarin static

我有一个联系人列表,我想发送邮件到我点击的邮件地址。但是现在我只能发送邮件给静态地址(StaticMail@gmail.com)。如何点击我的列表视图上的邮件到地址?

我的联系人:

使用System.Collections.Generic;

namespace App3
{
    public class Kontakter
    {
        public string Fuldenavn { get; set; }
        public int Tlfnr { get; set; }
        public string Email { get; set; }

        public List<Kontakter> GetKontakter()
        {
            List<Kontakter> kontakter = new List<Kontakter>
        {
            new Kontakter
            {
                Fuldenavn = "bacon (ANSE)",
                Email = "Random@gmail.com",
                Tlfnr = 12345678,
            },
            new Kontakter
            {
                Fuldenavn = "Anja (ANBI)",
                Email = "Random@hotmail.dk",
                Tlfnr = 87654321,
            },
            new Kontakter
            {
                Fuldenavn = "Benn (BMR)",
                Email = "Random@hotmail.com",
                Tlfnr = 12876534,
            },
            new Kontakter
            {
                Fuldenavn = "Christian (CBE)",
                Email = "Nothing@gmail.com",
                Tlfnr = 18273645,
            },
        };
            return kontakter;
        }
    }
}

我的职能:

private void OnEmailTapped(object sender, EventArgs e)
{
    var emailMessenger = CrossMessaging.Current.EmailMessenger;
    if (emailMessenger.CanSendEmail)
    {
        emailMessenger.SendEmail("StaticMail@gmail.com");
    }
}

我的XMAL.CS:

<StackLayout>
<Label Text="{Binding Email}" TextColor="Black" FontSize="Medium" />

<Label.GestureRecognizers>
 <TapGestureRecognizer Tapped="OnEmailTapped"/>
</Label.GestureRecognizers>
</StackLayout>

0 个答案:

没有答案