Windows Phone TextBlock content related task launch.

Recently one of my friends asked some help to solve an easy problem. His app has a few TextBlock, each text block contains a phone number or an e-mail address. He wanted to launch phone call or e-mail based on TextBlock’s text.
The solution is easy, attach DoubleTap event to the TextBlock:

    <TextBlock DoubleTap="TextBlock_DoubleTap_1" ></TextBlock>
    <TextBlock DoubleTap="TextBlock_DoubleTap_1">+123456789</TextBlock>

Then add a few line of code inside the created event handler:

if (sender is TextBlock)
    string content = ((TextBlock)sender).Text;
    if (!string.IsNullOrEmpty(content))
        if (content.Contains("@"))
            EmailComposeTask ect = new EmailComposeTask();
            ect.To = content;
            ect.Subject = "Greetings!";
            ect.Body = "Message from my application";
            PhoneCallTask pct = new PhoneCallTask();
            pct.PhoneNumber = content;
            // pct.DisplayName = "Call from application";

    e.Handled = true;
    e.Handled = false;

Well, the validation is bit dummy, but will serve the educational purpose.