Windows 8–the road so far

by Nico 10. February 2012 15:57

So it’s official, the Windows 8 beta, nicknamed Consumer Preview, will hit the worldwide web on February 29th. Time to list what we know so far.

For consumers:

  • the classic start menu has been replaced by a Metro interface, still unsure if there will be an option to bring back the classic menu
  • the windows desktop has now been extracted from the kernel and is just an app
  • Windows 8 utilizes much less resources then Windows 7, allowing it to run smoothly on weaker hardware
  • boot time is impressive, it takes mere seconds to launch. The cause is the fact that Windows 8 doesn’t shutdown completely, it’s kernel goes into hibernation. When you do a hard reset of the device you’ll notice that booting takes more time but it’s still noticeably faster than Win 7
  • Windows 8 will have two types of applications, the classic ones like we know them on Win 7 and Metro style applications. These Metro apps run completely full screen, no chrome like titlebars or borders
  • Metro apps run either full screen or snapped, running side by side with another app (even desktop apps)
  • Windows 8 comes with it’s very own Marketplace. Here you can download all kinds of Metro style applications
  • the ribbon that has been in Office since version 2007 now makes it’s way into the Windows explorer but it will be collapsed by default
  • Pinball and solitaire are installed games by default. Available in the store at launch will be:
    • Hydro Thunder
    • Toy Soldiers
    • Reckless Racing
    • Angry Birds
    • Ilomilo
    • Rocket Riot
    • Full House Poker
    • Tentacles
    • Crash Course
    • Ms Splosion Man
    • Wordament
  • Following apps will be included in the Consumer Preview
    • Camera
    • Messaging
    • Mail
    • Calendar
    • SkyDrive
    • People
    • Photos
    • Video
    • Music
  • Win 8 will be available on x86/x64 cpu’s and for the first time on ARM, mostly used in tablets
  • ARM versions of Windows will have both desktop and metro interface and comes with Office 15, a new Office version
  • Your profile (settings, wallpaper, …) will be synched to skydrive so that every time you buy a new Win 8 pc you don’t need to set everything manually
  • Refresh and Reset options, a refresh will keep all files and folders but will put Windows back in a fresh installed state, removing all installed applications and settings while a reset will do the same but also deletes all files and folders for all profiles
  • native USB 3.0 support
  • Windows 8 can mount and browse ISO and VHD files
  • UEFI Safe boot to prevent boot sector virusses
  • full backwards compatibility

For Developers:

  • anyone with XAML experience will be able to build Metro apps
  • Metro style takes a lot of the concepts of Windows Phone 7 and Silverlight
  • Instead of using the dreadful Win32 API developers can now use WinRT which provides a much cleaner way to interact with the OS
  • Metro apps are NOT .net code
  • .net 4.5 is included in Win 8
  • Metro apps in C#/VB/C++ + XAML or Javascript + HTML

 

Windows 8 will be pretty different compared to win 7. The developer preview has been out since September and I’ve been using it on a Iconia Tab W500 tablet since December. At the time I started using it I also had an iPad 2 but there’s just something special about a full blown OS on a tablet device, especially when running Win 8. I like the OS so far. The developer preview has lots of bugs, obviously, so I’m very curious about the performance and stability of the Consumer preview. Due to the stability problems I haven’t spend much time developing metro apps, this will change with the consumer preview. I’ll probably start by converting my WP7 apps to Win 8. More about that when I get to it.

Tags:

.Net | Windows programming | Windows 8 | Metro

Techdays Belgium 2012

by Nico 2. February 2012 08:27

So Techdays is right around the corner and I’ll be attending for the third time.I’ll be attending all kinds of sessions going from Windows 8 development to the complete deep dive track on web to my favorite subject, Windows Phone 7 development. I’m also excited about the Scott “The Gu” Guthrie doing the opening keynote and doing a session the second day. Also presenting this year is Laurent Bugnion, the father of the awesome MVVM Light framework.

Here’s the list of sessions I’ll be attending, this list is subject to change depending on if I change my mind the last minute, as I’m known to do sometimes Glimlach.

Tuesday February 14th

  • Opening keynote with Scott Guthrie
  • Welcome to the Metro Application Platform
  • Windows Phone Fast App Switching, Tombstoning and Multitasking
  • The Future of C# and Visual Basic
  • Devices + Cloud: Using Azure on iOS, Android, Windows Phone, …

Wednesday February 15th

  • ScottGu unplugged
  • Take a ride on the Metro
  • The zen of async: Best practices for best performance
  • MVVM Applied: From Silverlight to Windows Phone to Windows 8
  • MVVM & WCF RIA Services: an architectural story
  • Building a data intensive application

Thursday February 16th

This is a deep dive day, I’ll be following the web track that focuses on what’s new in ASP.net 4.5 and Visual Studio 11

 

Tags:

.Net | Presenting | WP7 | Windows programming | XAML | XNA | Web development | MVVM Light | Devices

Comic Organizer part II: Going metro

by Nico 6. October 2011 19:19

In part 1 I talked about MVVM and MVVM Light, I hope you learned something from it. Now it’s time to move on to the next part, we’re going to start building a WPF application.

First things first, here are the tools I’m going to use:

The WPF toolkit is a set of controls that extend the default WPF controls, it’s build by Microsoft and updated a few times a year.

If the MVVM Light toolkit is installed you should see new project types when creating a new project in Visual Studio. I’m going to create a new WPF 4 project.

Now that the project is created, take a look at the solution explorer, there you will find the MVVM parts nicely ordered in separate folders. If you want you can take them and put every part in a separate project, I won’t be doing that for my application since it’s pretty small.

 

Now that we got our project, let’s metronize it. For this we need to open the solution in Expression Blend. The best way to work on XAML based projects is to open the solution in both Visual Studio and Expression Blend, changes made in one will automatically be reflected in the other.

Metro isn’t a style that is out of the box available for WPF. While searching for a way to imitate the Metro windows like Microsoft uses it in Zune I stumbled upon the blog of Steven Hook. He had the idea of using the Wingdings font for the upper right buttons. Sounds weird? Let me show you how it works.

In Expression Blend I’ve set the WindowsStyle property to “None” and ResizeMode to “ResizeWithGrip”, the generated XAML looks like this

Code Snippet
  1. <Window x:Class="ComicOrganizer.MainWindow"
  2.         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3.         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4.         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5.         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6.         mc:Ignorable="d"
  7.         Title="Comic Organizer"
  8.         DataContext="{Binding Main, Source={StaticResource Locator}}" WindowStyle="None" ResizeMode="CanResizeWithGrip" AllowsTransparency="True">

This gives a clean white window without borders that can be resized by using the grip in the lower right corner. Next step is adding the controls for closing, maximizing and minimizing the window. This is the XAML responsible for those buttons

Code Snippet
  1. <Grid
  2.     x:Name="HeaderGrid"
  3.     Height="50"
  4.     VerticalAlignment="Top" Grid.ColumnSpan="2">
  5.     <Grid
  6.         x:Name="DragableArea"
  7.         Background="White"
  8.         MouseDown="DragableGridMouseDown"/>
  9.     <StackPanel
  10.         Orientation="Horizontal"
  11.         Margin="0,5,5,0"
  12.         HorizontalAlignment="Right"
  13.         VerticalAlignment="Top"
  14.         Background="White">
  15.         <TextBlock
  16.             x:Name="ChangeViewButton"
  17.             Text="2"
  18.             FontFamily="Webdings"
  19.             Foreground="Gray"
  20.             Margin="0"
  21.             VerticalAlignment="Top"
  22.             HorizontalAlignment="Right"
  23.             MouseLeftButtonUp="ChangeViewButtonMouseLeftButtonUp" />
  24.         <TextBlock
  25.             x:Name="MinimizeButton"
  26.             Text="0"
  27.             FontFamily="Webdings"
  28.             Foreground="Gray"
  29.             Margin="5,0,0,0"
  30.             HorizontalAlignment="Right"
  31.             VerticalAlignment="Top"
  32.             MouseLeftButtonUp="MinimizeButtonMouseLeftButtonUp" />
  33.         <TextBlock
  34.             x:Name="MaximizeButton"
  35.             Text="1"
  36.             FontFamily="Webdings"
  37.             Foreground="Gray"
  38.             Margin="5,0,0,0"
  39.             HorizontalAlignment="Right"
  40.             VerticalAlignment="Top"
  41.             MouseLeftButtonUp="MaximizeButtonMouseLeftButtonUp" />
  42.         <TextBlock
  43.             x:Name="CloseButton"
  44.             Text="r"
  45.             FontFamily="Webdings"
  46.             Foreground="Gray"
  47.             Margin="5,0,0,0"
  48.             HorizontalAlignment="Right"
  49.             VerticalAlignment="Top"
  50.             MouseLeftButtonUp="CloseButtonMouseLeftButtonUp" />
  51.     </StackPanel>
  52. </Grid>

The “DragableArea” grid will allow the application to be dragged around the screen by the user, just like any app does. The Stackpanel takes care of the 4 buttons in the upper right corner.

Now we need to implement the logic for these buttons, the buttons are actually textblocks but will behave like buttons. The blog that I got this idea from said that the logic of the buttons is the responsibility of the view, so even in an MVVM application it could be placed in the code behind file of the view. I tend to agree with this logic so I’m going to place it in the code behind as well, although it’s perfectly possible to put it in the ViewModel.

The complete code behind file looks like this:

Code Snippet
  1. using System.Windows;
  2. using System.Windows.Input;
  3. using ComicOrganizer.ViewModel;
  4.  
  5. namespace ComicOrganizer
  6. {
  7.     /// <summary>
  8.     /// Interaction logic for MainWindow.xaml
  9.     /// </summary>
  10.     public partial class MainWindow : Window
  11.     {
  12.         /// <summary>
  13.         /// Initializes a new instance of the MainWindow class.
  14.         /// Metro style logic is done here because it's the responsibility of the View
  15.         /// idea found on http://stevenhook.blogspot.com/2011/01/wpf-borderless-window-controls.html
  16.         /// </summary>
  17.         public MainWindow()
  18.         {
  19.             InitializeComponent();
  20.             Closing += (s, e) => ViewModelLocator.Cleanup();
  21.         }
  22.  
  23.         private void CloseButtonMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  24.         {
  25.             Close();
  26.         }
  27.  
  28.         private void MaximizeButtonMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  29.         {
  30.             WindowState = WindowState.Maximized;
  31.         }
  32.  
  33.         private void ChangeViewButtonMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  34.         {
  35.             WindowState = WindowState.Normal;
  36.         }
  37.  
  38.         private void MinimizeButtonMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  39.         {
  40.             WindowState = WindowState.Minimized;
  41.         }
  42.  
  43.         private void DragableGridMouseDown(object sender, MouseButtonEventArgs e)
  44.         {
  45.             if (e.ChangedButton == MouseButton.Left)
  46.                 DragMove();
  47.         }
  48.     }
  49. }

 

These little methods speak for themselves, if you have any questions about them feel free to leave a comment or contact me via mail, twitter, …

That was it for this second part, we now have a running WPF application in Metro style using some easy tricks. I believe that Microsoft will give a real Metro style out to the community, when they do I’ll probably convert this app to use the real style.

In part III we’ll start receiving data and maybe some databinding as well, who knows? Glimlach

Stay tuned for part III in a couple of weeks!

Tags:

.Net | Windows programming

Comic Organizer Part I: MVVM Light

by Nico 5. October 2011 20:22

All right, let’s grab a beer and get this show on the road shall we?

First topic I want to discuss is MVVM, Model-View-ViewModel. A big mistake people tend to make is to call MVVM a framework, in reality MVVM is a design pattern, a best practice guide to build a structured loosely coupled application. MVVM works great in WPF, Silverlight and Windows Phone 7 development. Windows 8 Metro apps will also be great to use MVVM in.

So let’s walk through the different parts of the pattern, I know there are thousands of articles about this subject on the net but bear with me, things will get interesting.

Let’s start off with a small diagram

All right, keep this in mind and let’s start discussing the different parts.

The View

First subject is the view, the view in our WPF application will consist out of XAML files, these files describe the user interface and all the controls on them. This includes buttons, checkboxes, radiobuttons, listboxes, etc. The only thing that the view is aware off is what viewmodel it is binded too and what controls are bound to what property on the viewmodel. There is no business logic in the view and although there is a code-behind file, the rule is to keep it as clean as possible. The viewmodel and control bindings happen in the XAML code, each XAML control has a property that can be bound to a viewmodel property. An example of binding a button:

Code Snippet
  1. <Button x:Name="SearchButton" Content="Search" Margin="0,50,0,0" Command="{Binding SearchCommand, Mode=OneWay}"/>

When the button is clicked the Binding command goes searching in the viewmodel for a command called SearchCommand and executes it.

The ViewModel

The viewmodel contains all the data that needs to be shown on the view. These data are contained in properties that are bound to the controls on the view. Apart from data that is shown on the view, the viewmodel can also contain a bunch of commands that can be bound to events, most often used for a button click. The advantage of seperating form and form logic is that it’s very easy to bind a new view to an existing viewmodel, it’s just a matter of adding controls on the form and binding them to the right properties. The command used in the example of the view is defined like this:

Code Snippet
  1. public RelayCommand SearchCommand { get; private set; }

RelayCommand is a class from MVVM Light that implements the System.Windows.Input.ICommand interface.

The ICommand interface is what you need to implement if you’re not using an MVVM implementation by a third party. The interface looks like this:

Code Snippet
  1. public interface ICommand
  2.     {
  3.         bool CanExecute(object parameter);
  4.         void Execute(object parameter);
  5.         event EventHandler CanExecuteChanged;
  6.     }

The relaycommand now needs to know what method to execute when it’s called. This is usually done in an InitiateCommands method like this:

Code Snippet
  1. private void InstantiateCommands()
  2.         {
  3.             SearchCommand = new RelayCommand(LoadList);
  4.         }

This will call a method called LoadList when the button is clicked. You can, off course, use anonymous methods like this:

Code Snippet
  1. private void InstantiateCommands()
  2. {
  3.     SearchCommand = new RelayCommand(()=>
  4.                                             {
  5.                                                 //...
  6.                                             });
  7. }

for those not familiar with anonymous methods, when the button is clicked all instructions between the brackets are executed. I’ll show more examples of databinding as I get further into this serie.

The Model

The model is often a separate object and contains the business logic. Classes that process the information that the viewmodel uses to pass to the view or that is passed to the viewmodel from the view.

MVVM Light

So what is this MVVM Light thing all about? MVVM Light is an open-source MVVM implementation created by Laurent Bugnion and can be downloaded from Codeplex. MVVM Light can be installed from Codeplex or from NuGet. When you install it from Codeplex you get new project types for WP7, WPF and SilverLight. Laurent recently added a preview version for Windows 8 Metro apps. Now what sets MVVM Light apart from its competitors? For me personally, the ease of use. MVVM Light just makes sense, it’s easy to use, Laurent has some nice documentation and some videos from events where he talked about his toolkit. The toolkit also contains a great messaging system that allows an application to send messages between all classes and projects within an application, a great tool that helps you create nice loosely coupled applications. Recently a very basic IoC container was added to the toolkit, which really shows the dedication and hard work that Laurent puts in his product. The container allows the viewmodels to accept instances from classes without tight coupling them, more about that when we get to it in future posts.

I really hope this first post made some sense, it’s the first time that I’m writing a series of blogposts while learing about the subject myself. If I made any errors or you’ve got some questions, feel free to drop me a message on Twitter, mail or leave a comment.

See you soon in Part 2!

Tags:

.Net | WPF | Windows programming

Starting new blogseries

by Nico 5. October 2011 19:36

My comic application for Windows Phone 7, called ComicDB, has been published for a good month now and as I’m working on version 2 I got an idea to build a Windows desktop application. The application will allow users to maintain a library of comic series and to keep track of owned and read issues, something I’m struggling with myself. I decided to make a blogseries about my progress, I started working on it today so I’ll try to get the first post online in a few days.

Some details:

  • WPF application
  • Metro style
  • MVVM Light
  • trying to use the SOLID principles

I’m currently learning SOLID principles and design patterns, so some refactoring might occur but I think it’ll be fun for you to follow my learning progress and it’ll be fun for me to build now and to look back to in a few years

Tags:

.Net | WPF | Windows programming

MS certification

by Nico 17. February 2011 10:25

I'm currently working on getting my MCPD (Microsoft Certified Professional Developer) certificate on Windows development in VS2010. I need to pass 4 exams for this:

 

You can follow the progress here

Tags:

.Net | Windows programming

Techdays Belgium 2011

by Nico 29. December 2010 13:36

The Belgian Microsoft Techdays 2011 will take place 26-27-28 April at Metropolis Antwerp.

I'll be attending, hope it will be as good as last year.
Things I look forward to:

  • Silverlight 5
  • C# 5 (asynchrony in particular)
  • HTML5 and CSS3
  • Windows Phone 7 development
  • Hopefully some XNA session

Info on the techdays can be found here

Tags:

.Net | Web development | HTML | Silverlight | Windows programming

About the author

Hi,

My name is Nico, I’m an MCP living in Belgium.
I’m currently employed as a .Net Software Developer at RealDolmen, one of Belgium’s leading IT single source providers.

I'm also founding member and board member of the Belgian Windows Phone User Group. If you're in Belgium feel free to drop by if we're doing an event. http://www.wiphug.be

This blog will be about Windows Phone 7, C#, XNA , WPF, Silverlight, and much more!

I hope to get feedback from my readers either through comments, mail (nico_vermeir@hotmail.com), twitter, facebook, …

 

Month List