Windows Mobile Arabic/Persian language support

By Mohammad Mahdi Ramezanpour at January 07, 2009 00:49
Filed Under: SmartDevices

Arabic/Persian language support on Windows Mobile using Arabizer - Photo taken from http://i4.tinypic.com/8511r1w.jpg Recently, I developed a SmartDevice application using .NET Compact Framework 3.5 Windows Mobile 5 SDK. Customer wanted me to develop the application with Persian language support so I started normally and used Persian because I didn’t feel anything bad. After I wanted to deploy it for tests, I realized that Windows Mobile 5 doesn’t support Arabic/Persian language by default! I also understood that Windows Mobile 5 does not support some specific SQL collations such as “SQL_Latin1_General_CP1256_CS_AS” because it hasn’t that kind of encoding until you install a specific encoder for it.

After some researches, I found a Pocket PC software name Arabizer which enables Windows Mobile to support Arabic language and it’s free to try. But as you may know, there are some specific characters in Persian language that Arabic doesn’t have.

I went through forums and found out that there is a company which had been developed an application based on Arabizer which adds Persian characters to it. This application is monetary but you will need it when want to develop a Persian application in Windows Mobile environment.

Because it was very difficult for me to find such an application, I decided to upload it here so you can download and have a free trial and I’m sure you’ll be definitely buying it if you want to develop an Arabic/Persian language SmartDevice application. Click here to download Arabizer.

With IMAGiNET Pocket Arabizer, you can Enter, Edit, and View Arabic Data inside Microsoft Applications, not only using an Arabic Soft Keyboard, but also using Arabic Handwriting character Recognition. You also get Prayer Times, Hijri Calendar and Arabic English bidirectional dictionary.

You can also download iPhone version if you want Arabic/Persian language support on iPhone.

Note: For those who want to add Persian language support to Arabizer I have to say that the name of that company is Part Asia.

Things you may need to know, when want to start working on Windows Services

By Mohammad Mahdi Ramezanpour at December 30, 2008 18:51
Filed Under: SmartDevices, Windows Services

As you may know, recently, I’ve done a project based on Windows Mobile for a hotel and because of their restaurants orders.

As one of their requests, they wanted me to use their previous ordering system in order to print bills. Their previous developer had been developed a parametric exe file that takes 4 parameters and then prints the bill out. So I needed to develop something on their servers in order to execute that old application. I decided to write a Windows Service that takes pocket pc requests via a wireless network connection and then print the bill out.

Working with Windows Service is not very often so you may not be able to find good articles for it but in this post I want to write about Windows Services.

Windows Service classes are very similar to normal classes except that you must implement them from the ServiceBase class. ServiceBase class is available in System.ServiceProcess namespace.

Keep in mind that you must import the System.ServiceProcess name space in your application because you will need this when want to work with Windows Services.

When you implemented your class from ServiceBase class, Visual Studio adds two methods to your class named “OnStart” and “OnStop”.

OnStart method:

This method allows you to write code you want to be executed when starting the service. You will need this method the most!

The OnStart method has an input parameter (A string array) which takes parameters that you may want to send to your service.

OnStop method:

This method will be executed when you’re stopping your service. Imagine that you’ve created a Thread in order to do something but you need to kill it when you stopped the service. In order to do such a thing, you have to make use of OnStop method.

Now what?

Adding an installer - Photo taken by myself. After writing your codes, it’s time to use your service. To make your service usable, you must add an installer to your application. Adding installer is easy when working with Microsoft Visual Studio; just right-click on your service designer and select “Add Installer” like the following picture.

When adding an installer, Visual Studio adds a class named “ProjectInstaller” and then adds two controls to your installer class named “ServiceInstaller” and “ServiceProcessInstaller”. By selecting each of those controls you can set some properties such as ServiceName, Description, DisplayName, etc.

Note: While setting the properties, don’t forget to verify the ServiceName property that must set to your service class.

You can also add your own codes to the ProjectInstaller class depend on your service.

How to install a Windows Service?

After building the service, you can access its files by going to the debug or release folder. You got two ways (Correct me if I’m wrong) to install a Windows Service.

· Programmatically.

· Manually.

Install or uninstall a Windows Service using Command Prompt - Photo taken by myself In this post, I want to install our service manually because it’s more common.

In order to install a Windows Service, you need to use Microsoft Visual Studio Command Prompt.

In the Command Prompt, we have an “installutil.exe” file that enables you to install and uninstall your Windows Services. Here is the syntax:

For install: installutils.exe [Your file path].
For uninstall: installutil.exe /u [Your file path].

How to get the application path in SmartDevice Applications

By Mohammad Mahdi Ramezanpour at December 01, 2008 06:41
Filed Under: .NET General, SmartDevices

It’s very common to get the application path in Windows/Web applications. When you want to access a file in your application directory, you have to use these codes:

VB:

My.Application.Info.DirectoryPath

C#:

Application.StartupPath

The question is how to get this path in SmartDevice applications because you don’t have any StartupPath or DirectoryPath when you’re working with SmartDeviceApplications?

In order to do such a thing, you need to work with System.Reflection.

The System.Reflection namespace contains types that retrieve information about assemblies, modules, members, parameters, and other entities in managed code by examining their metadata. These types also can be used to manipulate instances of loaded types, for example to hook up events or to invoke methods.

The System.Reflection namespace has an Assembly class which you can use in order to access your assemblies. That Assembly class has a GetExecutingAssembly() method that returns the assembly that is currently executing. When you get your assembly you need its name; so the GetName() method of GetExecutingAssembly() returns a class as AssemblyName. The last part is CodeBase property which returns the location of that assembly.

Now you have a path of your application. But this path contains your execution assembly too. In order to get the directory name of your application, you need to use System.IO.Path.GetDirectoryName() that returns only the directory name of a path.

Here is the complete code:

return Path.GetDirectoryName(
   Assembly.GetExecutingAssembly().GetName().CodeBase);

Currently Reading

Quote of the day

Send Persian SMS