Windows 8 Metro Tips and Tricks

Windows 8 Metro Style

It is important to know some key shortcats in order to be productive and efficient when working in Windows 8 specially in Metro style Mode. Since any Metro App does not have Exit option it is important to know how to return back or how to log off or turn off our PC.

Since there is no Exit command in Metro, applications cannot be exited in the traditional way. In fact every Metro style app has three states Active- when it is showed on screen, Suspended- when it is in background and Destroyed- when OS kill the process of your app. When other Windows 8 Metro app is launched, the previous application goes off the screen and becomes suspended. After about 5 seconds application goes to transient state. It is important to know that suspended apps are not removed from memory, but all their threads are suspended. On that way suspended application can be activated and showed on the Metro screen immediately. On the other hand suspended apps don’t consume energy or they consume energy in minimum amount. Suspended apps can be terminated of a low memory condition. This is the case when the application is relaunched as a new run. During relaunching it can be implemented so that the app can restore its state from persistent storage and appear to the user as if it has never been gone.

At the end of this blog post let’s review the shortcuts for some action in Windws 8 Metro:

  • winkey – switch between Desktop and Metro mode
  • winkey+L – Log off from the Window current session
  • winkey+F – Open Metro Search engine for searching different content: Apps, files, settings, etc
  • winkey+P – Change Monitors layout.
  • winkey+any – Starts searching for content.
  •  winkey+ESC – Back to Desktop mode (Windows 7++).
  • winkey+i –    Setting of Desktop, Power, Audio and Network.
  • winkey+o – Lock screen rotation.
  • winkey+d –  Whos Desktop mode (Windows 7++)
  • winkey+h –  Open the share charm
  • winkey+k –   Open the connect share charm
  • winkey+TAB – Toggles between opened apps
  • winkey+SPACE – Toggles input language and keyboard
  • winkey+c –   Open the “charms bar” (share, settings, shutdown)
  • Mouse RClick on App Tile – shows the App Bar with advanced option.
  • ALT+TAB – Switch between apps.
  • Press any key – Unlock screen
  • CTRL+SHIFT+ESC – force to close metro app, since there is no Exit option in app.

Yet another scientific work based on GPdotNET

University of Bihać will organize 8th Scientific Conference about Development and Revitalization of production (RIM 2011) this week. I am also on this conference with my work about Modeling Hardness of steel weld by genetic programming, which is based on my genetic programming tool GPdotNET. I am very proud to announce that this is my second work based on the GPdotNET. After my work about modeling and optimization of Drilling process by Evolutionary algorithms from 2007, this time it is about modeling steel weld. This work is introduction of my Master Thesis which is going to be out soon :).
The presentation will be at Saturday at 9:30. More abut the conference can be found at
Meet you there.

Consuming WCF in Windows 8 Metro style app

Asynchronous programming is introduced in a new version of programming languages (C++, C# and JavaScript) which are part of the WinRT and .NET. If you are programming in C# you can program asynchronous by using async and await keyword. In fact when you program with async and await you actually program as ordinary synchronous code. That’s the big thing about this type of programming model.
More information about C# asynchronous programming you can found in my previous posts.
Since we have asynchronous programming model in all languages calling service operations asynchrony is not relevant at all. We can just forget it and start writing code like synchronous. To see hot new pattern is reflected in WCF lets implement simple service and simple metro style app consumer.
Implementation of the WCF Simple Service:

  • Create new ASP.NET Empty Web App
  • Add new Item-> WCF Service
  • Name it as SimpleService.svc

Service Interface looks like the following implementation:

public interface ISimpleService
    [WebGet(UriTemplate="AllData",ResponseFormat= WebMessageFormat.Json)]
    List<string> GetSomeData();

Implement one operation in the service like the following code implementation:

public class SimpleService : ISimpleService
    public List<string> GetSomeData()
        List<string> lst = new List<string>();
        for (int i = 0; i < 10; i++)
            lst.Add(string.Format("Item number {0}", i + 1));
        return lst;

The mentioned operation returns list of string but between populating the collection we sleep the current thread for 0,5 second in order to simulate log running operation.

It is necessary to publish the WCF service on remote host, in order to consume it. I still dont know why WCF service cannot be consumed by Metro app on the localhost. After the service is published on remoter host, we are ready to create Metro style Consumer app.

  • Right click on solution item
  • Add New Project
  • Choose Application template from the Metro Style app
  • Name it WCFConsumer

  • Add service reference to C# Metro Stryle app.
  • Add the GridView and some other input controls (buttons, editbox , etc) that we can test application responsiveness. Add the following XAML code in MainPage.xaml:
<Grid x:Name="LayoutRoot" Background="#FF0C0C0C">
        <ColumnDefinition Width="151*"/>
        <ColumnDefinition Width="326*"/>
        <ColumnDefinition Width="207*"/>
        <RowDefinition Height="74*"/>
        <RowDefinition Height="185*"/>
        <RowDefinition Height="68*"/>
    <GridView x:Name="gridData" Grid.Column="1" Grid.Row="1" />
    <HyperlinkButton Content="HyperlinkButton"   Grid.Column="1" HorizontalAlignment="Left" Height="25" Margin="58,30,0,0" VerticalAlignment="Top" Width="126"/>
    <Button Content="Button" Grid.Column="1" HorizontalAlignment="Left" Height="40" Margin="69,8,0,0" Grid.Row="2" VerticalAlignment="Top" Width="182"/>
    <TextBox Grid.Column="2" HorizontalAlignment="Left" Height="27" Margin="21,79,0,0" Grid.Row="1" Text="TextBox" VerticalAlignment="Top" Width="161"/>
    <TextBox HorizontalAlignment="Left" Height="15" Margin="24,79,0,0" Grid.Row="1" Text="TextBox" VerticalAlignment="Top" Width="102"/>
    <Image Grid.ColumnSpan="2" Grid.Column="1" HorizontalAlignment="Left" Height="100" Margin="312,240,0,-272" Grid.Row="2" VerticalAlignment="Top" Width="100"/>

The picture below shows the example ot the mainPage.

  • Implement Loaded event in to MainPage.xaml and insert the following code.
private void UserControl_Loaded(object sender, RoutedEventArgs e)
        SimpleServiceNamespace.SimpleServiceClient client = new SimpleServiceNamespace.SimpleServiceClient();
        var servicedata = client.GetSomeDataAsync();
        gridData.ItemsSource = servicedata.Result;

Even if GetSomeDataAsync method is asynchronous we don’t implement callback because this operation is implemented based on the async and await C# keyword and no need to do that.
Just assign the result of the servicedata to the GridView.ItemsSource.
If we run the app, we can see that the data is loaded asynchronously and UI is not blocked. We can click on buttons, tipe some texts while data is loading. This is awesome and now we can think about application logic instead of callback service implementation. This programming pattern works not just for Metro style apps, in fact it works for all .NET 4.5 based applications.

Metro style Apps in Windows 8

We have seen a lot of news from the past week. There is a new technology announced from Microsoft: Metro Style App and Windows Run Time. This is software platform under new Microsoft upcoming OS Windows 8, which can run on various hardware: PC, Notebook, Tablet and Phone. Great source about this can be found on and related msdn web site. There are also plenty of sessions about all programming languages and platforms, so if you want to be uptodate with the latest Microsoft technologies don’t lose time, go to site and learn about new Metro style Apps and Windows 8.

I am going to show two diagrams which are very important, in order to understand how metro style apps and Windows Runtime stand in Windows 8 and what about existing .NET platform.

Arhitecture diagram of Windows 8 for developer perspective is shown here.

Windows 8 Architecture diagram

As can be see Windows Runtime is neither .NET nor a part of it. This is brand new platform natively supported by Windows 8. C# and VB are not exclusively .NET languages. By C# you can program .NET applications and Metro style App as well.

Regarding the Windows Runtime you can develop Windows 8 Metro style apps in several languages like C++, C# and VB, as well as JavaScript and HTML5. Every Metro style App goes through Language projection before access Windows Runtime and Windows 8 Core. Language projection has similar logic as IL in .NET but it is completely different technology.

The big thing is that every language supports asynchronous programming model which metro style applications gives responsiveness and better user experience.

You can also mix the JavaScript and C# components. Just make a C# components define it as WinMD file output type, include in JavaScript and HTML project and use it as ordinary JavaScript component. We can see this in further blog post. With WinMD file you can reuse some C# components and use them in HTML and JavaScript project.

Windows Runtime architecture

That’s all for the first blog post about new Windows 8 and Metro style app. In the next post we going to talk about WCF service and consuming it in Metro style apps.

Sastanak MSCommunity BiH UG sa temom Introduction to WCF

U Sarajevu se 15. septembra se održava sastanak svih User Grupa u BiH, na kojem će se govoriti o stanju u User grupama u BiH, te kako pomoći sami sebi (UG u BiH) razmjenjujući iskustva, predavače i slične stvari  međusobno. Prije samog sastanka, noć prije održaće se sastanak MSCommunity BiH na kojem ću održati predavanje o Windows Comunication Foundation (WCF).

WCF predstavlja jedinstevnu platformu za distribuirane servisno orjentisane aplikacije. U ovom predavanju biće prezentirano šta je WCF ili Windows Comunication Foundation, te se upoznati sa osnovnim komponentama i pojmovima ove tehnologije. Na predavanju će većim dijelom biti predstavljeni Demo primjeri upotrebe WCF u raznim situacijama prilagođenim tehničkom nivou 200 i 300.

Tokom predavanje biće prikazani demo primjeri deploymenta, consuminga odnosno WCF sa raznih kiljentskih platformi te pokazati WCF u punom kapacitetu kao jednu od Microsoftovih najuspješnijih tehnologija danas.

Predavanje i sastanak će se održati 14. sep. 2011. god.  u Microsoft BiH  Sarajevo sa početkom u 18:30 sati. Prijave za sastanak, kao i ostale informacije o cjelokupnom sastanku možete pogledati na oficijelnoj stranici MSCommunity BiH

Vidimo se na sastanku.

Predavanje o Monodoridu na MobilityDay konferenciji

Sada već možemo reći tradicionalno, hrvatske firme Citus doo i Mobendo doo iz Zagreba održavaju po 8 put konferenciju posvećenu mobilnim rješenjima. I ove godine predavanje će biti organizirana za tri ciljene grupe polaznika.

Razvojni smijer koji će govoriti o zadnjim novostima u svijetu Windows Phone 7 i Bada OS, te Monodorid platformi – .NET framworku (Mono) koji se vrti na Android telefonima. Pored toga biće riječi o HTML5 aplikacijama kao jedinstvenoj tehnologiji za sve mobilne platforme. Takodjer, neće biti zaobiđena ni tema Cloud computinga i njihove primjene u mobilnim rješenjima.

ITpro smijer će govoriti o nešto laksim temama administracije i serverskim rješenjima, dok će poslovni smijer govoriti o upotrebi mobilnih tehnologija u svakodnevnom poslovnom okruženju.

Predavanja će držati vodeći strani i hrvatski stručnjaci na području mobilnog razvoja i mobilnog poslovanja, među kojima posebno ističemo Microsoft MVP-e iz Hrvatske, Bosne i Herzegovine, Engleske i Njemačke, te stručnjaci iz Microsofta, Nokie, VIPneta, Samsunga i SAP-a.

Ove godine pripala mi je čast da držim predavanje zajedno sa Damirom Dobrićem oko Monodroid platforme (Mono for Android) i razvoju Android aplikacija na microsoftovoj razvojnoj plaftormi .NET (Mono) i Visual Studiu 2010. Svakako da Android kao najraširenija platforma ima mjesta na ovakvim konferencijama, a posebnu čar ima kada to radite sa C# i .NET Frameworkom i VS2010 kao IDE.

Konferecija će se održati 21. septembra u Zagrebu u Hotelu Antinović.

Više informacija o konferenciji možete fobiti na

Vidimo se na konferenciji.