Development with Visual Studio Online

Visual Studio Online offers a Team Foundation Server on the cloud. This is free up to 5 users, each additional user cost $10 per month. The free version includes:

  • Complete integration with Visual Studio
  • Private code repositories
  • Backlog to track bug task, also Agile Processes
  • Continuous Integration Builds

This features together with the free or paid versions of Visual Studio provides a great development environment. Visual Studio Online can also be used with Eclipse and XCode.

Let’s try this features with the development of my Chess Clock for Windows Store:

Visual Studio Integration
The integration of Visual Studio Online and Visual Studio is straight forward…

1. Register in Visual Studio Online
2. Create a team project online
3. Login with your account from Visual Studio
4. Create or Open a solution and add it to Source Control

This is the Visual Studio Online Home Page:
visualStudio-online-home
From this view it is possible to create the backlog items and bug entries, see the code, create test plans, configure continuous integration builds and download the generated binaries as a zip.

Code Repositories
Having the code online is great to forget about backups, also Visual Studio Online offers the same advantages that TFS: Change set history, Code comparison, associate code check-in with bugs of user histories, etc.
visualStudio-code-compare

For my development I have configured a Main branch for development, and a Production folder with branches for each release.
tfs-branches

Continuous Integration
At the moment I have configured only one build configuration: Main.ChessClock.CI. This build is in Release mode and triggered automatically after a code check-in on the Main branch.

References:
Visual Studio Online

Advertisements

Cross-platform App: Windows 8 + Windows Phone

The goal is to develop an application for Windows Store and Windows Phone maximizing code sharing.

We will need at least three projects:

  • ChessClock.Core: The logic and all common code and helpers the application can share, a Portable Class Library Project.
  • ChessClock.WindowsPhone: Windows Phone application project referencing the ChessClock.Core
  • ChessClock.WindowsStore: Windows Store application project referencing the ChessClock.Core

This is the current projects diagram:

projects diagram

Microsoft recommends to put ViewModels in the Portable Class Library, see Share functionality using Portable Class Libraries.

I prefer to put it together with the view because in my opinion view models should be only the glue between the view and the model, viewmodel should adapt the model to the view, and view models cannot contain logic but could contain for example a code that ask something to the user using a MessageBox or similar, and this is completly UI related.

Moreover this forces me to keep my viewModel as simple as possible, all the logic and data must be contained on Models.

Small part of my GameViewModel:

// Initialize commands
this.ReplayCommand = new RelayCommand(this.DoReplay);
this.PlayCommand = new RelayCommand(this.DoPlay);
this.PauseCommand = new RelayCommand(this.DoPause);
/// <summary>
/// Does the pause.
/// </summary>
private void DoPause()
{
    this.GameController.Pause();
}
 
/// <summary>
/// Does the play.
/// </summary>
private void DoPlay()
{
    this.GameController.Play();
}
 
/// <summary>
/// Does the replay.
/// </summary>
private void DoReplay()
{
    // Ask continue or start a new game
    var questionResult = MessageBox.Show(string.Empty, Core.AppResources.NewGameGamePage, MessageBoxButton.OKCancel);
    if (questionResult == MessageBoxResult.OK)
    {
        this.GameController.RestartGame();
    }
}

Difficulties found:

Converters
The interface IValueConverter is contained in different assemblies because the current culture on Windows Store App is a string and in Windows Phone is a CultureInfo object.
Microsoft decided for some reason to change this…

// Windows Store:
public object Convert(object value, Type targetType, object parameter, string culture)
// Windows Phone:
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)

So far the converters will be duplicated and located on the platform specific projects, I hope to have an idea to solve this later.

Helpers
The helpers that already exists where designed for Windows Phone, they make use of specific features as IsolatedStorage, or XNA to play sounds.
As this is not available for Windows Store a refactor of the helpers classes is necessary. The solution will be use interfaces inside the core, platform specific version will have to implement this interfaces.

References:
– Cross-Platform Development
– Portable Class Library

Windows Store – Privacy policy

This application does not collect or transmit any user’s personal information, with the exception of technical information included in HTTP requests (such as your IP address). No personal information is used, stored, secured or disclosed by services this application works with.

If you would like to report any violations of this policy, please contact us.

Windows Phone 8 – MVVM

I wanted to implement a simple Windows Store application to see how the publishing process works and compare the implementation with the implementation of a Windows Phone or Desktop WPF application. To do this I thought it would be a good idea to take the sample application I implemented for Windows Phone two years ago and migrate it to a Windows Store application. The application is a simple Chess Clock.

App Windows Phone Store Link

The idea is to refactor the actual code and implement exactly the same application for Windows Store.

There are some points that I wanted to improve from my previous version:

  • Get rid of the notification property changed code and trigger it automatically, Fody is great for this.
  • Remove the OnNavigateTo and OnNavigateFrom from my pages code behind, move this code to the view models. I implemented a couple of base class for this.
  • Separate my Models in two class, one should contain only the logic and the other one the status.

So far this is the class diagrams of my Game Clock:

GameDiagram

References