Skip Ribbon Commands
Skip to main content

Building Global Applications for Windows Mobile Devices

Nowadays mobile devices are used for a variety of applications such as telecommunication, messaging, data storage, and accessing remote devices. With rapid modernization, these devices are becoming indispensable and increasing the demand for applications built for these devices.

Windows mobile devices, such as pocket PC, smart phone, hand-held PC, personal digital assistance, and palmtop PC, are based on Win32 Application Programming Interface (API). The .NET Compact Framework, which is a version of .NET Framework, allows you to develop applications for the Windows mobile devices. The .NET Compact Framework supports many of the namespaces present in the .NET Framework. It also contains unique namespaces to access the SQL server CE and to transfer data between devices using infrared rays.

The .NET Compact Framework allows you to develop applications in Visual Basic and C#. The .NET Compact Framework also supports various GUI controls such as, Button, TextBox and ListBox. It does not support the controls, such as ErrorProvider, ColorDialog, and FontDialog. The .NET Compact Framework also allows you to program the soft keys in the devices such as pocket PCs.
The .NET Compact Framework provides an emulator to run the applications developed for windows mobile devices. The emulator simulates the hardware and software features of the mobile device.
With the demand for mobile applications growing across the world, it makes more sense to create globalized applications. Globalized applications can be easily customized for people of various countries and varied culture. The .NET Compact Framework provides the System.Globalization namespace, which contains the classes that allow you to build globalized applications for Windows mobile devices. Table x-x-1 describes the various classes present in the System.Globalization namespace:
Classes Present in the System.Globalization Namespace
Class Description
Calendar Defines the calendar styles followed by different countries. This class also allows you to retrieve and set the calendar style of different countries.
CultureInfo Holds culture specific information such as language, country, region, and calendar.
DateTimeFormatInfo Contains date time information. It includes the date and time pattern and the AM/PM designators.
GregorianCalendar Defines the Gregorian calendar, that has 12 months in a year and each month has 28 to 31 days. It has 365 days in a non leap year and 366 days in a leap year.
HebrewCalendar Defines the Hebrew calendar that has 12 months in a non leap year and 13 months in a leap year. It has 353 to 355 days in a non leap year and 383 to 385 days in a leap year.
HijriCalendar Defines the Hijri calendar that has 12 months in a year and each month has 29 to 30 days. It has 354 days in a non leap year and 355 days in a leap year. In the Hijri calendar, the leap year comes once in 30 years.
JapaneseCalendar Defines the Japanese calendar, which is similar to the Gregorian calendar. The only differences are in the era and the year. For example, the 2001 AD in Gregorian calendar is similar to the Heisei 13 in the Japanese calendar.
JulianCalendar Defines the Julian calendar, which is similar to the Gregorian calendar. The only difference is that the Julian calendar defines the leap year as the year divisible by four. But the Gregorian calendar defines the leap year as the year divisible by four except the years divisible by 100. This calendar is not used now, because it is inaccurate.
KoreanCalendar Defines the Korean calendar, which is similar to the Gregorian calendar. The only differences are in the era and the year. For example, the year 2001 AD in Gregorian calendar is the year 4334 in the Korean calendar.
NumberFormatInfo Defines the currency and the numeric symbols used by a culture.
RegionInfo Contains information about a country or a region. The information includes name, currency symbol, ISO currency symbol, three letter ISO region name, and two letter ISO region name.
StringInfo Allows you to divide a string in to text elements and iterate using these elements.
TaiwanCalendar Defines the Taiwan calendar, which is similar to the Gregorian calendar. The only differences are in the era and the year. For example, the year 2001 AD in Gregorian calendar is the year 90 of the Taiwan calendar.
ThaiBuddhistCalendar Defines the Thai Buddhist calendar, which is similar to the Gregorian calendar. The only differences are in the era and the year. For example, the 2001 AD in Gregorian calendar is similar to the year 2544 in the Thai Buddhist calendar.
TextInfo Defines the style of writing such as casing followed by a culture.
To use the above said classes in a global application, you need to import the System.Globalization namespace in your application. For example, you can obtain the various regional information using the RegionInfo class. Listing x-x-1 shows how to retrieve regional information from the RegionInfo class:

Imports System.Globalization

Public Class Form1

    Inherits System.Windows.Forms.Form

    Friend WithEvents ListBox1 As System.Windows.Forms.ListBox

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim NewRegionalinformation As New RegionInfo(TextBox1.Text)

ListBox1.Items.Add(NewRegionalinformation.EnglishName)

ListBox1.Items.Add(NewRegionalinformation.CurrencySymbol)

ListBox1.Items.Add(NewRegionalinformation.ISOCurrencySymbol)

ListBox1.Items.Add(NewRegionalinformation.ThreeLetterISORegionName)

ListBox1.Items.Add(NewRegionalinformation.ThreeLetterWindowsRegionName)

ListBox1.Items.Add(NewRegionalinformation.Name)

ListBox1.Items.Add(NewRegionalinformation.IsMetric)

ListBox1.Items.Add(NewRegionalinformation.TwoLetterISORegionName)

End Sub

End Class
The above code retrieves the information such as English name, currency symbol, and three-letter ISO region name of the specified region. The code also displays the retrieved information in a list box. When you execute the above code, it displays the controls added to the form. You can now specify the region/country name in the text box. For example, when you specify US and click the View Information button, you get the output as shown in Figure x-x-1:
Displaying the Regional information of US
This figure shows the Pocket PC 2002 emulator, which displays the regional information of US in a list box.  You can also specify the date using the Calendar class as given below:

Dim NewDate As New DateTime(2001, 1, 1)

'Specifies the date as 1st January 2005.

Dim newregional As New JapaneseCalendar

MsgBox(newregional.GetYear(NewDate))

The above code sets the date of the device to first January 2005. You can use the classes such as, HebrewCalendar, HijriCalendar, JapaneseCalendar, JulianCalendar, KoreanCalendar, GregorianCalendar, TaiwanCalendar, and ThaiBuddhistCalendar to retrieve the corresponding dates in the respective calendars. For example, the code snippet below shows how to retrieve the year in the Japanese calendar for a date in the Gregorian calendar:

Dim NewDate As New DateTime(2001, 1, 1)

'Specifies the date as 1st January 2005.

Dim newregional As New JapaneseCalendar

MsgBox(newregional.GetYear(NewDate))

The above code finds the year in the Japanese calendar on first January 2005. It also displays the year in a message box as shown in Figure x-x-2:
This figure shows the message box displaying the year 13 in the Japanese calendar, which corresponds to the year 2001 in Gregorian calendar.
You can also create other such global applications for windows mobile devices using the .NET Compact Framework. These applications can be used by people of varied culture and languages all over the world.

This site uses Unicode and Open Type fonts for Indic Languages. Powered by Microsoft SharePoint
©2017 Microsoft Corporation. All rights reserved.