Quick Tip – Multi Project Solution in VS11

I’m using Visual Studio 11 since it was released as Beta. What can I say, I really get the new design and layout (monochrome and gylphs) which not every developer appreciates. But beyond design and layout I really like the new search feature and the navigation features added in the Solutions Explorer section.

Going to the quick tip, if you have created a project in Visual Studio 11 Beta and would want to add another project under the same solution you would get this:

Solution explorer without add new project

Yes no option to add new project! Normally (like in VS 2010) you will use the solution explorer to add a new project but there is no option on VS11 Beta.

 

Solution explorer in VS2010 with Add Project option

Solution:

To add another project just go to File – New Project – Choose any Template. On the same window at the lower portion you can find the Solution option. You have the option to Create a new solution or Add to solution.

Solution option under file-new project

This is where you can add existing projects to your solution. Note that this option is also available in Visual Studio 2010.

Solution Explorer not showing the Solution file?

If the solution is not showing in the solution explorer check if the Always show solution is enabled in your Visual Studio

Visual Studio Options screen

Go to Tools – Options – Projects and Solutions – General – Tick the Always show solution option.

There it is, a quick tip on working around Visual Studio 11. Enjoy VS!

 

 

 

Creating My First Windows Metro-style App

 

I’ve blogged last month on how to get started on building metro-style applications. Since then, I’ve been trying out the sample projects made by the Windows team to help developers be up to speed with Metro-style application development. The official Sample Pack is 306.4MB in size as of this writing. You can even vote a sample request that you would like the Windows team to add in the samples pack – Metro style apps Requests for Samples. The latest completed request is a sample USB Barcode Scanner, nice!

Blog Reader App

After checking on the samples and creating sample projects, I decided to create a basic application with Metro-style. I do not need to look far since one of the article is on how to create a basic Blog Reader. That will be a great app to start with especially if there is a step-by-step guide available 🙂

Basic Layout

This application sample lets you create the layout using the Metro style Blank Application template first. Using XAML, the layout will be created by manually adding a Grid, ListView and a Webview for the HTML content. Creating the layout in XAML is very similar to creating UI in Silverlight and other projects you created using WPF with XAML.

Blog reader app not using the template

Blank Template Xaml Project

Data Binding

Windows.Web.Syndication

Next we need go to get the data like thd Title, Author, Date of Post and the article from the blog. This data is available through RSS or Atom feed. These feeds will be taken care of by the SyndicationClient class so we do not have to worry about converting the feed or the data to XML.

SyndicationClient client = new SyndicationClient();SyndicationFeed feed = await client.RetrieveFeedAsync(feedUri);

Note that the Windows.Web.Syndication is new in WinRT. The .Net version of this library is the System.ServiceModel.Syndication. Shawn Wildermuth experienced a problem about images being stripped out when using the Web.Syndication namespace. Not the same case with this sample app though. Shawn mentioned from his tweet that this may not be true for all feeds.

Async and Await

Since we are using the SyndicationClient class, we need to implement an asynchronous process to retrieve the feeds. The async and await will help us implement asynchronous calls in WinRT.

public async Task GetFeedsAsync(){    
Task feed1 = GetFeedAsync("http://windowsteamblog.com/windows/b/developers/atom.aspx");    ...    
this.Feeds.Add(await feed1);    ...}

Notice in the code above, the async keyword is added in the method signature. This is required for us to use await keyword. The await keyword makes our application responsive while the application waits for the result of the call to retrieve the feeds. Simple implementation of an asynchronous operation, nice!


Using the Templates

In Visual Studio 11, you have the option use the Metro style templates like the Split Application and the Grid Application template. Using these templates can save you the time to layout your view just like in this case where we can use Split Page template to show the main blog list on the left and then at the side show the posts made on that blog.

Split view blog reader

 

Other sections described by the blog reader sample application are adding an app bar for your application options and the Storyboard where you can define the layout transitions e.g full screen, snapped.

I’m happy to be able to create this sample app and be able to look deeper into Metro style development. More metro style apps in my future posts!

Reference Links:

Windows 8 Consumer Preview Metro style app samples – C#, VB.NET, C++, JavaScript

Github Repo on Actual Source Code of this project