Gotchas Upgrading C# Projects to Visual Studio 2012

My previous post is about my experience developing for Windows 8 RTM using Visual Studio 2012, there were BREAKING changes with Visual Studio 2012 and I feel obliged to map my own efforts for the benefit of other developers. So I’m going straight to the topic. Most of the content is NOT from my own experience, I put them down here to compile the gotchas.

Everything you see here is actually available as a whitepaper published by Microsoft here.

From Shai Raiten’s excellent guide here, find and replace all namespaces found below to the value on its right:

Type Old Value New Value Comment
Class PointerEventArgs PointerRoutedEventArgs
Style FocusVisualBlackStrokeBrush FocusVisualBlackStrokeThemeBrush
Style FocusVisualWhiteStrokeBrush FocusVisualWhiteStrokeThemeBrush
Style ApplicationHoverTextBrush ApplicationPointerOverForegroundThemeBrush
Style ApplicationPressedTextBrush ApplicationPressedForegroundThemeBrush
Style ControlDisabledTextBrush ButtonDisabledForegroundThemeBrush
Style ApplicationSecondaryTextBrush ApplicationSecondaryForegroundThemeBrush
Style AppBarItemForegroundBrush AppBarItemForegroundThemeBrush
Style AppBarItemBackgroundBrush AppBarItemBackgroundThemeBrush
Style AppBarItemHoverBackgroundBrush AppBarItemPointerOverBackgroundThemeBrush
Style AppBarItemHoverForegroundBrush AppBarItemPointerOverForegroundThemeBrush
Style AppBarItemForegroundBrush AppBarItemForegroundThemeBrush
Style AppBarItemPressedForegroundBrush AppBarItemPressedForegroundThemeBrush
Style AppBarItemDisabledForegroundBrush AppBarItemDisabledForegroundThemeBrush
Style BackButtonBackgroundBrush BackButtonBackgroundThemeBrush
Style BackButtonGlyphBrush BackButtonForegroundThemeBrush
Style BackButtonPressedGlyphBrush BackButtonPressedForegroundThemeBrush
Style BackButtonHoverBackgroundBrush BackButtonPointerOverBackgroundThemeBrush
Style BackButtonHoverGlyphBrush BackButtonPointerOverForegroundThemeBrush
Style BackButtonGlyphBrush BackButtonForegroundThemeBrush
Style ListViewItemPlaceholderRectBrush ListViewItemPlaceholderBackgroundThemeBrush
Style ListViewItemOverlayBackgroundBrush ListViewItemOverlayBackgroundThemeBrush
Style ListViewItemOverlayTextBrush ListViewItemOverlayForegroundThemeBrush
Style ListViewItemOverlaySecondaryTextBrush ListViewItemOverlaySecondaryForegroundThemeBrush
Method this.Dispatcher.InvokeAsync( this.Dispatcher.RunAsync

My own additions:

Type Old Value New Value
XAML VerticalScrollMode=”Rails” IsVerticalRailEnabled=”True”

If you also wanna help with your experience, please leave a comment and I will update the list accordingly.

Windows 8 RTM & Visual Studio 2012 – Urbanesia on Windows 8

My first experience with Hello Worlds was through an old 8088XT that shows up a primitive BASIC IDE to hack on codes. Well now with the Urbanesia team and also past members of the team, we’ve created a native Windows 8 app for Urbanesia. We were in it from the start when Windows 8 was seeded as a Developer Preview. Our first IDE was Visual Studio 11 Beta that is now Visual Studio 2012.

Urbanesia is a BizSpark member and therefore, we gained benefits such as being the first to enjoy Microsoft products that has yet been released publicly. Our MSDN account enables us to download almost all of Microsoft’s commercial, development and enterprise products to be used without any complicated and expensive expenses for 3 years. I downloaded Windows 8 Pro and Visual Studio 2012 Ultimate.

Our Windows 8 Bootcamp back in August taught us the core of coding for Windows 8. It’s relatively easy and stress free if you’re accustomed to Open Source flavours previously. We created a basic application in a few hours and learned how to effectively structure your web services data. Gained all of that knowledge really quick and mostly painless.

Windows 8 is now approaching its launch date and we were given an ARM tablet by Microsoft installed with WinRT to test our development efforts. To be honest, the tablet is great but we didn’t know what to do with it. We used it mostly to test our upcoming iteration of Urbanesia’s frontend web face. I got a Windows laptop with a really low spec and decided to install Windows 8 there and do some development work for our app.

Let me tell you this, to develop for Windows 8, you must install Visual Studio 2012 on a Windows 8 device. Trying to develop for Windows 8 on versions less than Windows 8 will give you a friendly warning that you’re fucked. This friendly warning made me download a Windows 8 ISO image from Microsoft. It turns out that our MSDN subscription was loaded with Windows 8 RTM and I followed through.

I installed Windows 8 on that crappy Windows laptop without any trouble and finding the performance of the laptop acceptable when I logged in. It wasn’t the same case with the Windows 7 installation. Microsoft did a great job with their new OS, really.

When Visual Studio 2012 was installed, I wasn’t expecting any trouble with our source code, but nothing great is produced without first encountering problems right? To keep it simple, the application didn’t work at all. Spent the better part of my Sunday to scour Google for answers. Before the Manchester United game (that they won), I can’t find what’s not working.

FYI, we are coding in C# for our Windows 8 application.

After the game, I was gonna give up but then inspiration usually comes when you’re about to give up. I hacked my way again into the source code and below is a list of gotchas you should pay attention when you’re gonna convert older Visual Studio 11 Beta projects to a Visual Studio 12 project:

  • After you realize that you’re fucked, close the solution for the project you’re working and create another project.
  • Close that new project you’ve just created and open up the primary project.
  • Copy paste your Common\StandardStyles.xaml file somewhere.
  • Open up explorer and navigate your way to the new project.
  • Go to the Common folder and copy paste everything to your primary project’s Common folder.
  • Now open up the newly pasted Common\StandardStyles.xaml and copy paste all of your previously created custom DataTemplate from your old copy.
  • Go to Shair Raiten’s excellent guide to upgrade Metro apps from Beta to RC here.
  • As you can see, there are a number of changes to naming conventions for classes, XAML styles and static class methods. For each XAML style items, do a Find/Replace, yes it sucks but it works. The same goes to classes and static class methods if you use any in your codes.
  • Clean your solution and be hopeful. Run it now.

So what does this taught me? Microsoft is getting it right over time but they don’t really like early adopters. They make us bleed with the current BREAKING changes with Visual Studio 2012 and offering us only white papers that I don’t like to read. This is done with even the Microsoft Indonesia dev team is not aware of. A sad fact but it’s true.

However, I got help from Pak Risman, Microsoft Indonesia’s Developer & Platform Director. He taught me the right way to do things with codes, this is something I’d understand.

To wrap things up, I’ll be submitting the app to Windows Store soon and hopefully satisfy the QA team over at Microsoft. Cheers!

Rooting and Installing Custom ROM on S-ON HTC Sensation

At the moment, I’m doing some weekend project coding in Android and since a Galaxy Tab does not qualify as a phone, I switched gadget. An iPhone for an HTC Sensation with my uncle. One thing I quickly miss is iPhone’s Retina Display, however the performance of the Sensation is sensational compared to my iPhone. Was happy until the battery keeps on dying out too soon. I figured HTC Sense played a big part, so I went hunting to get a Sense-less ROM.

The HTC Sensation I have on me is already running Ice Cream Sandwich, was updated OTA. This is good news for me because from some readings here, virgin ROMs are easy to be rooted. For the sake of clarity, here are some links that you’d find most useful in doing the we’re about to do.

  • Stock ROMs to revert back to factory defaults, here.
  • HTC Sensation/XE/4G AIO Tool (Windows based), here.
  • Virtuous Inquisition ROM, here.
  • Fastboot, just Google this.

Because we’re rooting and installing Custom ROMs with S-ON, there is a limitation on what is possible and what is not. First of all, you can only use ROMs that are based on HTC firmwares meaning that you CANNOT use ROMs that are coming from AOSP, CyanogenMod or any of those sort. However, there are some tricks you can try but I’m not responsible for any wrongdoings.

Before anything else, you should root and install a custom recovery. If you’re lucky enough to have your hboot version less then 1.18 then you should go ahead and visit Revolutionary.io, follow the steps there and you even get S-OFF and therefore the limitation in the previous paragraph does not apply to you. However if you’re not that lucky, use the AIO tool from the links above and run it to root your device.

You could actually do S-OFF with the AIO tool BUT you’d have to do it my meddling with some hardware. Since this is a borrowed unit, I’m not doing it. Now that you have root and custom recovery installed, you can go ahead and install a ROM.

  1. Download an HTC based ROM like the one I put above at the links section.
  2. Copy the ROM to the root directory of your device’s SD Card.
  3. Turn off the device.
  4. Unplug the battery and replug after a few seconds.
  5. Hold down Volume Down + Power buttons until it shows a white screen.
  6. Press Volume Down to select RECOVERY.
  7. Once you’re in the Custom Recovery, choose Install from a ZIP
  8. Select the ZIP file you downloaded earlier.
  9. Confirm the ROM installation
  10. Next you must Wipe Data and Wipe Cache + Dalvik

Now for the next part, since we’re still S-ON, the ROM script to overwrite boot.img will not work, it’s still protected by the device. What you can do now is to repeat steps 3 to 5 above. In your laptop/computer, unzip the ROM’s zip file and copy the file boot.img from kernel/pyramid/boot.img to somewhere you’re comfortable.

  1. On the device, select FASTBOOT by pressing the Power Button.
  2. If your device is properly connected with your laptop, the device will say FASTBOOT USB.
  3. Open up a terminal and do fastboot flash boot /path/to/boot.img
  4. Restart the device by doing fastboot reboot

Now you have an S-ON device with a custom ROM :)

Android Ice Cream Sandwich on Galaxy Tab 7

After a long break, I thought I wanna write about Android. This time it’s Ice Cream Sandwich on a Galaxy Tab P1000. As always, for smartphone hacks, everyone should first go to XDA-Developers.com and have a look if one of your gadgets has sub-forums. There’s a specific thread for Galaxy Tab 7 First generation and ICS love is there.

This blog post is a confirmation that ICS works beautifully and incredibly fast and snappy on a Galaxy Tab P1000. It is as if you are having a multi-core Android device. Have look at [ROM][ICS] AOKP (Android Open Kang Project) for P1000/L/N here. Follow the installation routines and you’re good to go.

Here are the steps I took to get ICS working:

  1. I reflashed the Tab with a Gingerbread ROM and ClockworkMod Recovery using ODIN
  2. Downloaded Milestone #4 ROM for P1000 which is listed on the thread
  3. Downloaded Gapps from the link on the thread
  4. Downloaded a ClockworkMod flashable kernel for P1000 from the link on the thread
  5. Went into ClockworkMod Recovery (Power + Volume Down)
  6. Mounted USB Storage and copied ROM, Gapps and Kernel packages
  7. Unmounted USB Storage and flashed ROM, Kernel and Gapps last
  8. Wiped Cache, Data and Dalvik Cache
  9. Rebooted the system
  10. I got an incredibly smooth ICS working on the Galaxy Tab
  11. The ROM’s performance was the best of any ROM I tried but the kernel kept nullifying the RIL stack, I downloaded HumberOS P1000 Kernel here and the problem disappeared
  12. A HAPPY GUY

Performance throughout the whole experience immediately alleviated by the ROM, not only the slick UI/UX had a welcomed boost but the Tab’s performance itself is just amazing. I was on a rooted Stock Gingebread version previously and this update made my day!

Graphics & 3D performance are amazing, everything is GPU Accelerated so it is a very smooth experience indeed. Gmail for ICS is also very relaxing!

ICS SettingsGmail for ICS

Augmented Reality Browser in 10 minutes with Wikitude API

This blog post is a simple tutorial to demonstrate how easy it is to set up a full fledge Augmented Reality browser with Wikitude API. It will only take 10 minutes of your time in its most simplest form, ready to be customized with your own needs. It should be easy enough to let you innovate on your own.

For this to happen, I assume you already have these items ready with your setup:

  • Eclipse (Preferably Indigo)
  • Android Developer Tools for Eclipse here
  • Android SDK here
  • Wikitude SDK here

The project is live at Github: https://github.com/tistaharahap/ARBrowser

I believe codes will speak louder than words ;)