September 2012 Entries

This month Tom Benton will be presenting The Platform and Architecture of Windows Store apps in Windows 8. This is a subject that was requested by attendees over the last few months. Tom has been presenting this topic in Redmond recently and this should be a great discussion.

As usual we are interested in hearing what topics that community would like to see presented. Leave any ideas in the comments of this post. If you have a topic you are interested in presenting please contact me through this blog.

Store

Thank you to everyone who came out for last night’s presentation. Hopefully we will have a little better turnout next month when we are back on our regular night. I will post out the topic and the registration as soon as we get confirmation.

For those interested in last night’s presentation you can find the slides here. I am also planning on making a white paper post here with the full presentation content.

I originally started this post when I had the Windows 8 preview setup on VirtualBox image. I have since put the RTM bits on a Dell E6530 that is my new work laptop. It isn’t a table so I am not getting the touch experience, but as a developer this makes the most sense for the moment.

This is the first Windows OS that I have had to spend much time exploring to even get started. The first thing I ran into was when I clicked on the desktop icon I was lost. Where is the Start menu? Where are my programs? How do I get back to the Metro environment? I finally tried hitting the Windows button and it popped back out to the Metro screen.

Once I got past that I found that the look of the Metro interface is clean and well organized. It should be familiar to anyone who is already using a Zune or Windows Phone 7. In the Desktop, aside from the lack of the Start button to bring up programs the desktop is just like the Windows 7 environment we are all used to. I do have to say though that I don’t like popping out to the Metro screen to find program. I think installers for programs like ones that developers usually work in for a desktop mode will need to give an option for creating a desktop icon and pinning to the task bar of the desktop.

One of the things I do really enjoy is having live tiles in the Metro environment. It is a nice way of feeding my need for constant information. The one drawback though is that the task bar at the bottom of my screen used to be where I got this information without leaving what I was working on. It allowed me to see current temperatures and when there were messages waiting. I have since found that these still work as expected in the Desktop and Toast message keep you up on what is going on in the Metro apps.

Thankfully familiar functionality like Alt-Tab and Windows-Tab still work regardless of if apps are in the Metro or the Desktop environment. Add to this the ability to find any application on the Metro screen by simply typing and things get very comfortable.

I also started exploring some of the apps. If you want see a ton of stats on your team at a glance check out the Sports app. What games are coming up? Who are the leaders in a number of stats? The Weather and Finance apps have good features as well and I am sure they will improve as users supply feedback.

I have had to install Visual Studio 2010 side-by-side with VS2012 because the Windows Phone 7 SDK would only install on VS2010. This isn’t a Windows 8 issue per se, but something that you need to be aware of if you are a developer moving to the new ecosystem.

The overall experience is a joy despite a few hiccups. For anyone moving to Windows 8 in on a non-touch laptop or desktop I do suggest this list of keyboard shortcuts. Enjoy.

We are getting rolling again. This month I will be discussing Building Smart Phone Applications For The Enterprise. This is an area that I have been working with in my normal day-to-day work and think that more of us will be running across in the near future. Be sure to register and join us.

There aren’t many applications that are of value without having some for of data store. In Windows Phone development we have a few options. You can store text directly to isolated storage. You can also use a number of third party libraries to create or mimic databases in isolated storage. With Mango we gained the ability to have a native .NET database approach which uses LINQ to SQL. In this article I will try to bring together the components needed to implement this last type of data store and fill in some of the blanks that I think other articles have left out.

Defining A Database

The first things you are going to need to do is define classes that represent your tables and a data context class that is used as the overall database definition. The table class consists of column definitions as you would expect. They can have relationships and constraints as with any relational DBMS. Below is an example of a table definition.

You can then add the table class and its associated columns. It needs to implement INotifyPropertyChanged and INotifyPropertyChanging. Each level of the class needs to be decorated with the attribute appropriate for that part of the definition. Where the class represents the table the properties represent the columns. In this example you will see that the column is marked as a primary key and not nullable with a an auto generated value.

You will also notice that the in the column property’s set method It uses the NotifyPropertyChanging and NotifyPropertyChanged methods in order to make sure that the proper events are fired.

The last part of the database definition that needs to be created is the data context. This is a simple class that takes an isolated storage location connection string its constructor and then instantiates tables as public properties.

Creating A New Database Instance

Now that we have a database definition it is time to create an instance of the data context within our Windows Phone app. When your app fires up it should check if the database already exists and create an instance if it does not. I would suggest that this be part of the constructor of your ViewModel.

db = new MyDataContext(connectionString);

if(!db.DatabaseExists()){ db.CreateDatabase();}

The next thing you have to know is how the connection string for isolated storage should be constructed. The main sticking point I have found is that the database cannot be created unless the file mode is read/write. You may have different connection strings but the initial one needs to be similar to the following.

Using you database

Now that you have done all the up front work it is time to put the database to use. To make your life a little easier and keep proper separation between your view and your viewmodel you should add a couple of methods to the viewmodel. These will do the CRUD work of your application. What you will notice is that the SubmitChanges method is the secret sauce in all of the methods that change data.

Updating existing database

What happens when you need to change the structure of your database? Unfortunately you have to add code to your application that checks the version of the database which over time will create some pollution in your codes base. On the other hand it does give you control of the update. In this example you will see the DatabaseSchemaUpdater in action. Assuming we added a “Notes” field to the MyTable structure, the following code will check if the database is the latest version and add the field if it isn’t.

Today Nokia and Microsoft had an event to officially introduce the Lumia 920. Below is a rundown of some of the things I found interesting.

As a person who likes photography there was a lot to drool over. The main feature that caught my attention was PureView with its optical stabilization. This alone should improve the majority of you pictures. Add to that the SmartShoot Object remover that uses multiple images to remove unwanted people or objects that move through your picture and you never have to accept reality again.

For the most part the lenses concept introduced in Windows Phone 8 just makes the usability of leveraging camera better. Of course that is Microsoft’s selling point. One lens that caught my attention was the Bing lens. I have to say it is about time that we can take pictures and use them to search for answers using Bing.

There were a couple of features shown that involved augmented reality. One was similar to the yapf application that is already in the market which overlays restaurants and other destination over live camera views. The other was using the navigation directions with a live view.

Then you get down to some of the physical features of the Lumia 920. The one that got the most stage time is that it has a great 2000mah battery which can be charged wirelessly. They also pointed out the improved glare reduction of the 4.5 in. curved glass screen. This hardware improvement is improved further with software that detects glare conditions and adjusts the display attributes to enhance viewing ease.

Adding to the wireless cool factor of the Lumia 920 is the general NFC capabilities. This was demonstrated with NFC docking stations as well as JBL speakers and headphones.

There was one more hardware feature that I applauded. The super sensitive touch screen did away with one of my pet peeves with capacitive touch screens. You will never have to remove you gloves to operate your phone again. The mittens that they did the demo with looked more like boxing gloves.

I was disappointed with Joe Belfiore said that they were only going to show a couple of new features of the Windows Phone 8 and would hear more at future events. One of the things he did show is the ability to customize which buttons you preferred as defaults in IE10. For example you could have the folders button where the refresh button normally is. He also showed that at long last you can natively take screenshots on your phone. Hopefully he will be back quickly to give us the rest of the features.

The most disappointing part of the event was that we never found out when they would be released or how much they would cost. Let’s hope this comes soon. Even with these couple of items still left on my wish list I can’t wait to get my hands on a Lumia 920.

Tim is a Solutions Architect for PSC Group, LLC. He has been an IT consultant since 1999 specializing in Microsoft technologies. Along with running the Chicago Information Technology Architects Group and speaking on Microsoft and architecture topics he was also contributing author on "The Definitive Guide to the Microsoft Enterprise Library".