How to check whether Wi-Fi Connection is enabled on Windows phone device

In this short tip I shall be explaining you the simplest way to check the WiFi connection status in Windows Phone. This is a very necessary and required feature for all the apps that use an internet connection. For example if you you want to request something from the internet or send something to a server that may require an active WiFi connection then you need to be ensure WiFi is available to avoid errors. The code for the following is given below.


 

Validate a Email id using C#

We always get requests to write a tip/tutorial on validating an email id using c#. Its actually quite simple and can be done by using the following code snippets. isValidEmail takes a string inputEmail and returns true if the string is a valid email id. Basically it uses an instance of Regex class to check the string against the regular expression for a email id.

If you need more help then have a look at this article to see how it can be used elegantly.

http://www.maskaravivek.com/blog/windows-phone/how-to-validate-an-email-address-in-c/

Displaying circular image in Windows Phone 8.1 app

You may for some reason wish to display circular images in your Windows Phone 8 app.

Here’s a simple way of doing that using XAML.

Windows Phone 8

Windows Phone 8.1


Set the radius and center to half of height and width. In this example we have set height and width to 48px so we see Center at (24,24) and the radius ie RadiusX and RadiusY to 24.

Here’s a preview of how it looks

032114_1816_Displayingc1

Using text to speech in Windows Phone 8 and 8.1

You can use the Windows.Phone.Speech.Synthesis API to generate synthesized speech, also known as text-to-speech (TTS), in your Windows Phone 8 app. The following example creates an instance of a speech synthesizer and sets its language with the help of a LINQ query. The LINQ query searches through the VoiceInformation objects that describe each of the installed voices to find one whose language property has a value of “en-US”, which indicates the English language as spoken in US. The argument to the SpeechSynthesizerSetVoice(VoiceInformation) method specifies an index for the voices returned by the LINQ query. Find more details in this MSDN article

Note: To use TTS, you must set the ID_CAP_SPEECH_RECOGNITION capability in the app manifest.

If you are developing a Windows Phone 8.1 XAML app then use the following code instead.

Add a media element in your page and set its visibility to Collapsed if you don’t wish to display it.

Note: Add Microphone capability using Package.appmanifest.