This is going to be a quick post. Just over 2 weeks ago I got the Windows Phone Mango invite I was waiting for; my HD7 has been running mango in full glory since then. The installation took a long time but went pretty smoothly, backing the data up takes most of the time. I am really liking the Mango update, this is what windows phone should have been when it launched. Multitasking, IE9, better facebook integration in people’s hub and a plethora of other features. The voice command integration in mango is exceptional, and I find myself using it quite often. Being able to listen to an incoming message, compose a reply and send it, all using only your voice, is really amazing (or magical, as some might call it) and works really well.
Strangely, I am not using the multitasking feature all that much. Somehow I have an obsessive compulsion to keep the backstack clean all the time. Whenever I am done using the phone, I keep pressing the back button just to make sure there is nothing on the stack. I have a feeling I’m not alone.
In other news, AppHub gets some new features and Windows Phone is expanding to new markets. More importantly, Microsoft’s pubCenter, finally, will be available to developers outside of US of A. According to Todd Brix’s post, pubCenter should launch to new markets (including India!) before the end of 2011. I can’t wait to try out adCenter. You can read Todd’s post here,
I am still waiting for my invite. Looks like they are sending out invites starting from the list of supported countries, which unfortunately, India is not a part of. I’ll write when I get the invite and let you know how the installation goes on my HD7.
The consumer side of Windows Phone Mango was unveiled yesterday by Microsoft. It brings in some great new features like multitasking, IE9, fast application switching, maps, web marketplace etc to name a few. I was also impressed with enhancements to bing like local scout, bing vision and bing voice. With the NoDo update fiasco now behind us, I think the expectations are set just right for the ‘mango’ update which will be coming this fall ;) One thing that annoys me is the feature-market fragmentation that’s happening with Windows Phone. What’s the deal with making some features available only to a few markets! Just look at the way zune services and their features are split region-wise. It’s horrible and needs fixing.
Nothing was mentioned about Microsoft’s ad framework, PubCenter, and its expansion plans. It’s been close to 8 months since windows phone came out and PubCenter has expanded its market by zero, zilch, nada! There were talks a while back that it will be made available in europe, I don’t know how that’s working out. Hey you, make it global already! And show us some pay-per-impression love.
Like I mentioned in this post, if you installed the pre-NoDo update, the process would have required a fair amount of storage space on your primary drive depending on how much content you have on your phone. The Zune software takes a backup of your phone’s content before updating the OS on the device. This backed up data stays on your machine, here’s how to move the data to another location so you can free up some space on your primary drive.
On your machine navigate to the following location,
the folder AppData is hidden, so you’ll need to enable the option to show hidden folders. And depending on your configuration you may also need admin privileges to move stuff around. The Windows Phone Update folder contains the data backed up from your device,
All the data is present inside the RestorePoint folder. Move this folder to another location to free up space. Make sure you keep this backup of the backup safe, just in case something horribly bad happens to your windows phone 7 device.
One thing that was pending on my “todo” list from a long time was implementing the ‘Game Of Life’ on Windows Phone 7. I got the basic version running in a couple of hours and I’ve been thinking about improving it since and adding new features to it. Maybe I’ll submit it to the marketplace someday, who knows. I have also been reading about gestures, multi-touch, pinch-to-zoom and related topics and most importantly trying to understand the math behind each of those gestures, and the math is so elegant that it fascinates me!
Game Of Life Game Of Life is a simple cellular automaton in which you create a pattern in a world made of rectangular grids, start the evolution process and then watch the pattern change as the world evolves. The world is made up of dead cells initially, you create a pattern by selecting a few cells and giving them “life”. The world then evolves according to a set of rules (source: Wikipedia):
Any live cell with fewer than two live neighbours dies, as if caused by under-population.
Any live cell with two or three live neighbours lives on to the next generation.
Any live cell with more than three live neighbours dies, as if by overcrowding.
Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
Gestures like translation, scaling and rotation seemed complex to me at first, but they’re pretty simple once you understand the math that makes the magic happen. I came across two great articles that really dig deep into these concepts. Both articles use the Silverlight Toolkit for Windows Phone 7 and the gesture support that it provides. I was a little surprised to know that the silverlight toolkit actually uses XNA’s touch api’s to detect gestures. These are the articles that you must read:
Charles Petzolds’ implementation makes use of Matrix transforms. It took me some time to understand matrix transforms and realize their importance in 2D/3D graphics. The only time I used matrix multiplication was to solve silly linear equations in college. You’ll find many a articles on the internet about matrix transforms but the best resource I found again comes from Charles Petzold. Chapter 22 – From Gestures to Transforms in his free book Programming Windows Phone 7. Download it now if you haven’t already, it’s a great resource.
The two paths had to meet. Using gestures in Game Of Life was the best way to learn them.
In my first implementation of Game Of Life, I used the Manipulation Delta events to support pinch-to-zoom. In this I used the DeltaManipulation.Scale.X and DeltaManipulation.Scale.Y values in the ManipulationDeltaEventArgs class (passed to the ManipulationDelta event handler) to modify the ScaleX and ScaleY values of a Scale transform on the object to be scaled. If that sentence didn’t make sense, don’t worry, this is the easiest and the worst implementation of pinch-to-zoom. The scaling was not smooth or accurate. To understand what a perfect pinch-to-zoom should be read this – Pinch Zooming using XNA on WP7: Getting it right. The article explains this with reference to XNA but the concept remains the same everywhere.
In my second attempt I used the Silverlight Toolkit for Windows Phone and Francesco’s implementation of pinch-to-zoom. It was working pretty nicely with a few quirks here and there. Though the implementation is easy to understand, I felt there were too many variables used for storing state information and the code looked a bit messy, but it worked.
It is while tuning this implementation that the MSDN Magazine article was published. Charles Petzold’s implementation felt intuitive and was much cleaner. The only part I had to figure out was the matrix transforms he used. And that I’ll explain a bit here.
This is what the app looks like,
The rectangular grids are added programmatically to a canvas. Here is the XAML for the canvas,
So during the Drag Delta and Pinch Delta events the transforms under currentTransform are manipulated to achieve the desired effect and once the drag or pinch gestures are completed a function, TransferTransforms(), is called:
To understand what is happening here we need to look at the XAML first. The RenderTransform on the MainCanvas is a double-barrelled (term used by Charles in his article) transform. Basically, a transform group within a transform group. So the effective transform on MainCanvas is equal to the effect of previousTransform plus the effect of currentTransform. Well, it’s not exactly “plus”. First, previousTransform is applied on MainCanvas to change its state, and then currentTransform is applied on that state to change it further. If you download and look into Charles’ code, you’ll see that during drag delta and pinch delta events, only currentTransform values are modified. Once the drag or pinch gesture is complete, TransferTransform() is called to “transfer” the values of currentTransform to previousTransform. And this transfer happens by the way of matrix multiplication, which is what the function Mulitply() does. It’s not over yet. After the multiplication the values of currentTransform (i.e scaleTransform, rotateTransform and translateTransform) are reset. This is important because, as we discussed before, the effective transform on MainCanvas is effect of previousTransform “plus” the effect of currentTransform. Transferring the values of currentTransform to previousTransform and then resetting currentTransform keeps the effect same.
CacheMode and BitmapCache
Now I got the translation, scaling and rotation to work correctly, but the performance was not very great. There was a huge lag in pinching and dragging, and this is where BitmapCache comes in. Every UIElement has a property called CacheMode, which can be set to BitmapCache.
In XAML, CacheMode=”BitmapCache”
In code, uiElem.CacheMode = new BitmapCache();
When the CacheMode of a UIElement is set to BitmapCache, a snapshot of the UIElement is taken and is stored in the video memory. So the element is not redrawn every time, instead all the operations are performed on the cached bitmap. This is super fast and is particularly useful when working with transforms on controls. Change the MainCanvas element in the XAML to include CacheMode,
and this will have a dramatic effect on the performance as you will see in the video below.
Please leave a comment if you have anything else to add.
A quick post, about two days back I got a notification on my HD7 saying that there is a update available to be installed. Yes, it was the pre-nodo update that you might have read about on the windows phone blog. Just installed it, and it completed without any hitch. Reading several reports about some devices having trouble installing the update (particularly the Samsung ones) and some even getting bricked, I was wary at first. I waited two days and there were no reports of issues with any of the HTC devices. I went ahead and installed it today.
The only downside is that you might need a lot of space on your primary drive, close to 8GB for me, depending on how much data your phone contains. The update process backs up all the data in your phone, just in case something goes horribly wrong. The whole process took about 45 minutes, majority of the time for data backup. The OS version was updated from 7.0.7004.0 to 7.0.7008.0.
Well, the start screen disappears and all you see is the application list, which normally shows up when you scroll to the right. Pretty interesting I thought. So the start screen is basically a shortcuts screen on steroids, much nicer looking and with tile notifications.
The performance increase with the new emulator is clearly noticeable and the first time deploy is real quick! The emulator image should also be a precursor to the windows phone 7 OS update that we’ve been waiting for ever. The emulator image includes copy-paste functionality which is enabled by default on all textboxes, password boxes and edit controls within web browser control, so existing apps get this feature for free. Go ahead and give the new tools a try. If you want to experiment more you might be interested in a unlocked emulator image, follow the link for more information.
First up, the issue isn’t fixed yet. I still cannot login to AppHub using my windows mobile 6.x developer account and can’t view details of my Minesweeper app. Who knows how many copies its sold. I had numerous exchanges with Microsoft’s support team on the AppHub forums and via email as well (support ticket), but somehow we never managed to get to the root of it. In fact, the support team itself grew so tired of the problem that they suggested I create a new dev account.
I grew impatient, and it was really frustrating to have an app ready for submission but not being able to do anything with it. Eventually, the frustration had to show somewhere, and it was on this forum thread
Prabhu Kumar in reply to Nick
Nick, I feel for you and totally understand the frustration. Since day one I have been getting the XBOX profile linking error, We encountered an issue connecting your App Hub account with your Xbox Live Profile. Please visit Xbox.com and update your contact information. After you have updated your contact information, please return to the App Hub (https://users.create.msdn.com/Register) to continue. I have an app published on the Windows Mobile 6.x marketplace since Aug, now I can’t view the details of this app. I completed work on my WP7 application 1.5 months ago and the first version is ready for submission to marketplace, only if I can login. You can imagine how frustrating all this can be, the issue has taken far too long to be fixed, this has drained all my motivation.
I have exchanged numerous mails with Microsoft support team on this issue, and from the looks of it they really are trying their best, unfortunately, their best is not good enough for some of us. During the first week of December I was told that there would be an update happening to AppHub around mid of December. I was hoping that the issue would be fixed but it wasn’t. After the update the only change I notice is that the xbox.com link on the error page now takes me to the correct link. Previously, this link used to take me to the 404 page you mentioned above.
Out of desperation, I am now considering creating another developer account on AppHub with a new live id, even this I am not 100% sure will work.
I asked the support team when the next update to AppHub was planned and got this reply, “We do not have release date to announce for the next App Hub update at this time. In regards to the login issue you are experiencing at this point the only solution would be to create a new account with a different live ID but make sure to go to xbox.com before hand to get all the information in order on that side.”
I know it’s an extra $99, and not that I can’t afford it but it doesn’t feel right and I shouldn’t have to be doing it in the first place. I have lost all hope of this issue being resolved.
I went ahead and created a new dev account, the id verification was in progress when Shaun Taulbee of Microsoft, who has been really helpful in the forums, replied saying,
If you find it necessary to pay again to create a new account due to a Microsoft problem, send in a support request asking for a refund and we’ll review it (and likely approve it given the circumstances).
The thought of refund made me happy, but I had my doubts. So once my second account was verified by Geotrust I applied for a refund through the developer dashboard, by creating a support ticket. Couple of days later I got an email from Microsoft saying that the refund had been approved! yay! Few days and the refund showed up on my bill,
Well, thank you Microsoft, it means a lot. I am glad it’s over now. The new account works flawlessly. I would still like to get my first account working again and look at my app numbers for Win Mo 6.x, and probably transfer the credits to the new account somehow, but I’ll save it for another day. If you’ve had similar problems with the AppHub, and had to create a new account to submit your app, I suggest you contact the support team and get your dollars refunded!