Have you had a chance to play with SignalR yet? If not, you’re really missing out! While preparing for a Swedish .NET User Group presentation, I did a test screencast on all my content that was going into the presentation. This screencast is uploaded to youtube so go check it out! It’s a bit over 1 hour long but well worth it if you want to get started with SignalR or just get some new inspiration!
If I would have gotten a penny for every time that someone told me or tweeted: “I want the old start button back in Windows 8!” I would have been richer than Bill Gates. First of all, the problem is that people seem scared of change, not willing to step out of their comfort zone and try something different. I’ve been running Windows 8 since February 2012 and I’ve come to love it a lot. Despite the lack of the old start button, I still find the operating system much more productive than before and it’s very intuitive!
Windows 8 doesn’t lack a “Start button” but they’ve replaced the old one. Install a tool like Start8 is like painting a new red Ferrari F50 as a rainbow; simply not by design.
Windows 8 has different use-cases
When I attended //BUILD/ Microsoft gave me a very nice Surface that I really like and what I like the most is that the transition between a tablet and a desktop computer is an awesome experience. I use the two devices completely different but still feel like home when using both of them. I rarely go into the standard desktop mode on my Surface, I only do so when I need to do some Word-processing or just manage files and on my Workstation I rarely go into the new Start screen (Modern UI), I only do so when I want to use the very powerful search.
There’s a Start button on Surface and it’s required by all vendors as far as I know that it’s there. This hardware button is one of the replacements for the old start button!
I don’t really use that so much because I find it much easier to just swipe from the right and get another start button. You can also press Win + C to get to this menu and you can also bring the pointer to the right corners to get this menu showing up!
So far there has been four ways to get a start button showing up which brings you to the new powerful start menu. The hardware button can easily translate into the keyboard start button and the swipe from the right is the point in corners version.
However, that is not it! There’s actually another way to show a start button, which also dictates where the start menu will show up.
How do I know where the start screen shows up?
I’ve heard people saying that they think the behavior of where the start screen is showing up is random, but frankly it is not. If you have a Modern UI application running on Screen 2, this is where the start screen will show up. If you move the application to Screen 1, that is where the start screen will show up.
But if you don’t have a Modern UI application running, what then?
Use the start button in the corners!
This start button shows up when you hover the different left bottom corners on any of your monitors and it will bring up the start screen on that monitor.
So you were saying there’s no start button? The old start button is gone, the old start menu is gone. It has been replaced by something much more productive and intuitive, step out of your comfort zone and just adapt to it!
It’s all about HCI (Human-Computer-Interaction) and making the experience better for everyone, but it takes time change an old behavior. Why do you so eagerly want the old start button/menu back?
Yesterday was the first day of //BUILD/ at Microsoft Campus in Redmond, Seattle. There has been a lot of expectations on Microsoft for this event and boy did they deliver! The past year has been all about Windows 8, Windows Phone 8 and the very awesome updates to Windows Azure. //BUILD/ this year follows in its predecessor´s footsteps and deliver information about how we can write awesome applications for both Windows 8 and Windows Phone 8.
Me and my colleague from Star Republic arrived in Seattle a couple of days before the conference started to avoid being jetlagged during the session and be able to see a bit of Seattle. Despite all the rain in Seattle we have had a very nice visit so far. We’ve been able to see the Space Needle, the underground (which is awesome by the way), the harbor and much more. I really enjoy Seattle, maybe it is because it feels pretty much like Gothenburg. What’s best about it though is that it is flooded (not with water despite the rain) with geeks.
The days before the conference I had a chance to meet up with Scott Hanselman and a lot of the other amazing guys working on the ASP.NET team. If you haven’t seen the Day 2 Keynote the next part of this sentence is going to be a spoiler; I’m somewhat in the keynote! When I met Scott he needed material for his presentation, me and some other guys’ danced Gangnam style for him which was recorded and put in his and Scott Guthrie’s presentation. I don’t have the video available at the moment, it’s going to be available on C9 as soon as the keynote is uploaded. I recorded a little with my compact camera, but I forgot to bring a cable for it and unfortunately the Surface RT don’t accept an SD card!
All that was day two, besides for the actual recording, so up until now everything has been awesome. The sessions were all similar to the ones that we have seen over the year since last //BUILD/ but now that everything is shipped it’s more hands-on examples. I attended a couple of sessions about Windows 8 development with HTML and Javascript (and of course CSS). The most interesting session was the one about optimizing your web application by thinking about CPU usage. There are some very interesting tools in the Windows SDK that you can use to analyze the performance of a web application. Basically in most applications on the web, time is spent on waiting for resources to be downloaded which means it could be done asynchronously if possible and the other thing that is common is slow javascript with lots of DOM access.
As an attendee the highlight of the day was when Ballmer announced that everyone is getting 100GB of SkyDrive! I am actually going to swap from DropBox for a while to see if it is better or not. However that awesome present wasn’t enough for Ballmer so he also announced that everyone attending would get a Surface RT 32GB! When everyone calmed down and promised to write awesome apps for Windows RT, the VP for Nokia comes out on stage and gives away a Lumina 920 to everyone attending the confidence. At this time I wanted to lay down on the floor and cry of happiness. This was announced in the morning so we had to wait for our awesome devices for the entire day!
As soon as we picked up our stuff we went back to the hotel and I recorded an unboxing (I know most people hate those!) and hands-on.
Are you planning on getting a Surface?
I’m having high hopes for the ASP.NET session and hoping to see some things that will help me in my daily work. So far the Azure upgrades with Mobile Services and Add-Ons are Very promising and I am really looking forward to playing with it more. What is funny is that Halo 4 that is being release in the next months or so uses Azure a lot which forced them to rethink the server architecture.
Speaking of games, since everyone got a voucher for the company store which has heavy discount, I might grab an xbox controller to use for my next Windows 8 game. Do you have any experience with that? I would love to hear about it!
If you’re at //BUILD/ be sure to look me up and say hello and if not, just ping me!
Before we take part, I just want to say that I wrote this entire post on my Surace with the TouchCover. Takes some time getting used to.
I am going to step out of my comfort zone a bit and write a post that touches the surface of C++ in Windows 8. Let us start off by looking at an image of what the new WinRT(Windows Runtime) look like:
As you can see, there are a lot of powerful ways to create both metro style and desktop applications. Notice that in Metro style applications, XAML is connected to both C++ and C#/VB.
During my years of .NET development, the reason for using C# or VB has been; RAD(Rapid Application Development). In a world filled with consultants where the customers only see the end result, it can often be hard to convince that putting down 200% more time using C++ is a great idea.
Because let’s face it, it takes a lot more time creating a desktop application in C++ using MFC than what it would to use C# and XAML. Before someone throws a stick at me I have to say that it of course depends on what kind of application you are creating.
The downside from using a managed programming language is that it tends to be a bit slower; in some cases this is critical. Most customers do not care if they have to wait a couple of extra nano-seconds for a control to render.
What does this have to do with Windows 8 and the Windows Runtime?
I really got a nice tingly feeling in my stomach when I first saw that you could use XAML with C++ in Windows 8. But that is not the best part, the best part is that it is fully native!
This means that the designers can make the interface in expression blend and we can dig down into C++ on the backend.
Let us have a look at this! You will need to have Windows 8 Consumer Preview and Visual Studio 11 beta installed (or later) in order follow these examples.
Start off by creating a new blank Windows Metro style application, this is found under “Other languages -> Visual C++”:
When the project is created, you will see some files that have been generated, these are pretty similar to what we are used to see in a normal XAML application in .NET:
Open up the file “BlankPage.xaml”, this will bring you into the designer view of the XAML file. Add a TextBlock to the page:
As you can see in the preview, it shows a tablet with the current view inside it. Remember that we are working with a Metro application, the idea is that you have a metro application in fullscreen or pinned to one of the sides on your screen.
By only adding the TextBlock, this is the XAML that we have now:
If we now navigate to the file “BlankPage.xaml.cpp”, this is where we can actually access the TextBlock. When you compile your solution, the XAML will also be compiled to C++, just like the XAML in a normal .NET application is compiled.
However, to access the TextBlock and set the text of it to the current date, what do we write?
The TextBlock is actually a TextBlock^, the “^” is called a “hat”. Think of this as a pointer, but a pointer that you do not have to worry about disposing.
This means that you do not have to do delete on the object yourself, because it will be automatically removed once the context of it has been exited.
So in order to set the value of the TextBlock we do:
MyTextBlock->Text ="Hello World!";
We can test-run this before we display the current time. First, let’s select to run it in a simulator like this:
This will bring up a tablet emulator that mirrors your system:
Now let’s take a look at how to get the current date there instead of that “Hello World!” text. In WinRT you can access an object called Calendar which you can use to get the date and time.
In order to get a pointer/hat, you need to modify the instantiation a tiny bit. Instead of just writing this:
This lets the compiler know that this will in fact be a hat/”managed pointer”. Something that I have missed a lot when not working in C# is the keyword var and this has finally come to C++ with the more appropriate name auto.
So in order to get a calendar object, calibrate it to the current time and then set the text to the current date we can simple do it like this:
auto calendar =refnew Windows::Globalization::Calendar();
This has been a short post about how to create your first C++ Metro style application in Windows 8 and I hope you enjoyed the read, if you have any questions do not hesitate to leave a comment, tweet or e-mail.
Filip Ekberg is a Senior Software Engineer working in the country with all the polar bears, author of a self-published C# programming book and overall in love with programming.
Check out my recently published book.C# Smorgasbord covers a vast variety of different technologies, patterns and best practices that any C# developer should master.
All printed copies include access to the e-book bundle (PDF, ePub and Mobi!).