preload
Jun 18

When creating an application it is often a good idea to add support for localization so it’s easy to update and add new languages to your application. For the PinCodeKepper app I only need to localize the text since all icons and graphics used are international with no text attached.

Windows Phone 7 have pretty good localization support where you add a resource file for each supported language and the application will select which resource file to use based on regional settings on the device.

This article describes how I added support for localization on the PinCodeKeeper app.

Set up resources

Continue reading »

Tagged with:
Jun 14

The add new pin code functionality (completed in previous article) was the last main functionality for the PinCodeKeeper and the time has come to start using real data instead of mock up data. I will now implement Isolated Storage so that I can save/store new pin codes, retrieve all saved pin codes and delete pin codes from the storage.

The first thing I do is to add a new class that I call IsolatedStorageUtil.cs, this class will contain all functionality I need for saving, retrieving, deleting and some other utility methods. To use the DataContractSerializer you must add a reference to System.Runtime.Serialization.

You can see my IsolatedStorageUtil.cs class below.

using System;
using System.IO;
using System.IO.IsolatedStorage;
using System.Runtime.Serialization;

Continue reading »

Tagged with:
Jun 09

In this article I will create the “Add New” Pin code screen for my PinCodeKeeper WP7 app and I need to extend the earlier created Pin code card Custom Control. The Pin code card custom control displays a grid with coloured cells and numbers.

When adding a new pin code I want the Pin code card to display a grid with coloured cells, but no numbers. The user must be able to click on a cell to enter a number in it. I decided to add some very simple animation when the user click a cell. The cell will increase it’s size while positioning it self at centre in the top. This will be animated while the coloured grid fades out with a black colour.

Numeric keyboard

When the cell is in position I want a numeric keyboard to be displayed, I didn’t like to out of box options so I decided to make a NumericKeyboard Custom Control. I kept this very easy so I just made a custom control and added a button for each key on the numeric keyboard. I also created a delegate and a event handler with custom EventArgs so that the screen or control using the NumericKeyboard can hook up to keyboard pressed events and the pressed key value.

Continue reading »

Tagged with:
May 31

I’m working on the PinCodeKeeper Windows Phone 7 app and in this article I will walk you through how I made the Pin code card screen with a custom control to display the pin code card. I will continue from where I left when I previously completed the Pin code list screen.

The Pin code card screen will display the name of the card and a matrix with numbers on a coloured pattern. For the matrix that represents the good old pin code card I will create a custom control.

PinCodeCard custom control

To create a custom control right click in your Solution Explorer and select “Add” –> “New Item” –>”Windows Phone User Control”, name it PinCodeCard and click “Add”.

Continue reading »

Tagged with:
May 29

In the previous article I defined the project structure for the PinCodeKeeper WP7 app, in this post I will write the code to complete the Pin code list screen.

Creating the GUI

I start by creating GUI for the “PinCodeListView.xaml”. The GUI for this view contains a header, a list and an application bar.

Below you can see the xaml code for the “PinCodeListView.xaml”, notice the data binding capabilities I use for the pin code list. I also needed to add some icons for the application bar buttons. I found a free set of Mono Icons 32×32 that suited my app. I created a new folder called “Images” and added “plus32.png”, “questionbook32.png” and “stop32.png” to that folder. Remember that the images must be set to Build action: Content and Copy to output directory: Copy Always.

Continue reading »

Tagged with:
Mar 31

I am very fond of using patterns when developing and I have seen the importance of patterns in several projects. When it comes to Windows Phone 7 development I guess the most popular pattern to use is the Model-View-ViewModel (MVVM) pattern. I have successfully used a different (but still quite similar) pattern for several mobile app projects. In this post I will show you how to use the Model-View-Presenter (MVP) pattern when developing Windows Phone 7 applications.

I will not go into details describing the MVP-pattern since I covered that pretty well in another post I wrote a while back: Using Model-View-Presenter (MVP) pattern in Compact Framework. What I will do is to show an example on how you can design your Windows Phone 7 app architecture to use MVP-pattern. I will use the same login example as I used in the Compact Framework post. You can see that the biggest difference between how you do this for CF and WP7 is the data binding capability in WP7.

Before we go to the code a short summary on the essence of the MVP-pattern: The View is only responsible for displaying output to the user and receiving input from the user. The View will always ask the Presenter what to do with the data and the Presenter will pass the data on to the View. The Model consists of business objects and can be used both by the Presenter and the View. The figure below explains the MVP-pattern.

Now it’s time to have a look at the code. For this example I have created a solution called MvpDemo. To this solution I have added two projects. One Silverlight for Windows Phone – Windows Phone Application project called MvpDemo and one Silverlight for Windows Phone – Windows Phone Class Library called MvpDemo.MVP.

Continue reading »

Tagged with:
Mar 14

In this post I will write about what I have learned while working with camera on a Windows Mobile (.NET Compact Framework) project.

The first thing you need to do is to check if the device running your application supports camera. This is easily done by using the SystemState.CameraPresent property. To use this property you must add a reference to Microsoft.WindowsMobile.Status.dll and to Microsoft.WindowsMobile.dll. The following code is then all you need to check if there is a camera present:

        public bool CameraPresent()
        {
            return SystemState.CameraPresent;
        }

The next step is to open the camera viewfinder and take a snapshot. There are several ways to do this, one option is to use the built in CameraCaptureDialog. This is probably the easiest way to do it but you are then using the default Windows Mobile camera capture dialog and you can not graphically embed it in your application. To use CameraCaptureDialog you must reference Microsoft.WindowsMobile.Forms.dll in your project. The following code shows how to use the CameraCaptureDialog.

Continue reading »

Tagged with:
Feb 13

This is the last part in a series of four and will step by step explain how to use WCF services to access SQL Azure Database from Windows Phone 7 app. As an example I will develop a Windows Phone app where the user can create an account and later on log in to the account by user name and password. The accounts are saved in SQL Azure and I am using WCF for communication between the WP7 app and SQL Azure Database.

The book Beginning Windows Phone 7 Development has a very detailed chapter about using SQL Azure Database.

Part 1: Signing up to Windows Azure and create your SQL Azure Database

Part 2: Creating a cloud service (WCF service) to connect to the SQL Azure Database

Continue reading »

Tagged with:
Feb 13

This is part three in a series of four and will step by step explain how to use WCF services to access SQL Azure Database from Windows Phone 7 app. As an example I will develop a Windows Phone app where the user can create an account and later on log in to the account by user name and password. The accounts are saved in SQL Azure and I am using WCF for communication between the WP7 app and SQL Azure Database.

The book Beginning Windows Phone 7 Development has a very detailed chapter about using SQL Azure Database.

Part 1: Signing up to Windows Azure and create your SQL Azure Database

Part 2: Creating a cloud service (WCF service) to connect to the SQL Azure Database

Continue reading »

Tagged with:
Feb 13

This is part two in a series of four and will step by step explain how to use WCF services to access SQL Azure Database from Windows Phone 7 app. As an example I will develop a Windows Phone app where the user can create an account and later on log in to the account by user name and password. The accounts are saved in SQL Azure and I am using WCF for communication between the WP7 app and SQL Azure Database.

The book Beginning Windows Phone 7 Development has a very detailed chapter about using SQL Azure Database.

Part 1: Signing up to Windows Azure and create your SQL Azure Database

Part 2: Creating a cloud service (WCF service) to connect to the SQL Azure Database

Continue reading »

Tagged with:
Subscribe to my feeds Follow me on Twitter
DZone MVB