the magic inside the machine — a dream of Mohammad Elsheimy

Creating ‘mailto’ and ‘tel’ Link Handlers in C#

Overview

Many business websites show their email addresses and phone numbers so their customers can contact them. In this lesson we will create wrapper classes around ‘mailto’ and ‘tel’ HTML links in C#. Those classes will allow you to read and generate those links with ease.

Introduction

If you need
an introduction to mailto and tel links please check this and this.

What’s next?

You can use the same mechanism for any other special link. Adrian
Ber wrote a very useful blog post
about those links. Moreover, in a future post we will see how this mechanism can
be integrated into Android WebView to allow your application to respond to mailto
and tel links.

Many refactoring patterns and fixes can be applied to the code. Please feel free to comment with your updated code.