Hungarian Dictionary
Written by Peter on Thursday, August 18th, 2011
Yay, I've been published! No it's not a book, it's my first Windows Phone application that went live on the Marketplace. That's one giant leap for me, one small step for mankind. :-) It's an English-Hungarian and German-Hungarian dictionary which works from a locally stored database. Select the dictionary type you need, then just start typing your word and it will filter the results for you on the fly. Tap on a word to see its translations in detail, you can even add it to your favorites. Check out the screenshots as they pretty much speak for themselves (although they are hard to hear in this size) then I will tell you about the challenges I had with this project.

First of all, I got my phone a few weeks ago and I haven't had any experience with the OS before. Let alone writing an application in Silverlight which was new to me, however it's not all that different from what I'm working with on a daily basis: ASP.NET and Windows.Forms but still, it needed some adjustment. I started with watching the superb WP7 Jump Start videos of Rob Miles and Andy Wigley, they are very cool chaps and I can say, very efficient teachers.
I was thinking what I should do as a learning project and this dictionary just felt right for this platform from every angle. I've created its predecessor in 2009 for Windows Mobile 5.0, it was a dinky little PDA application for my own use, but the most important part of it, the dictionary database files were done so I didn't need to put energy into that, I could start with basically rewriting the dictionary handler class to make it a bit more efficient and use internal caching for the search as you type method I was about to build into this new app.
Then I had to bite the silver bullet with creating a user friendly GUI that embraces the Metro design language, respecting the user's theme settings of dark / light background and chosen accent color, but still look good and having visible graphic buttons in each case. First I was thinking of using a panoramic layout but as it turned out the pivot layout is a better choice for the app's needs.
I ran into some problems and bugs, too... Silverlight has a ListBox control which was a great choice for the job of displaying search results, first it was all fine and dandy, especially in the emulator. But running the first version on my actual device revealed that my dictionary searching is blazing fast, but then the system keeps waiting for the ListBox control's shockingly slow rendering to finish. Alright, starting over, let's create my own ListBox control that actually works with more than 5 list items... Frankly I expected a bit better performance from the standard one. Then I had to deal with the shortcomings of my solution, two dynamically generated TextBlock controls in a StackPanel for each word, with click detection, hosting the whole bunch in a ScrollViewer... At least it's way faster. Obviously, pivot panning and list scrolling shouldn't register as unintended item selection. And it shouldn't be scrollable if there is no need to scroll due to the small number of items displayed. This issue might be solved in Mango, the emulator doesn't scroll, but on the current OS release it sure does. Anyway, it was great fun to work out all these issues.
I was almost ready when I decided that beside the Search, Translations and About pages I will add a Favorites & History handler page. I'm glad I did, it turned out to be a very cool feature, but my application already handled the Deactivated - Activated states and it kept crashing away when I tried to come back to the Favorites page from Tombstoning. Only one 3rd party application can run in the same time, when the app is not active due to running some other program that takes the screen away, my app practically gets killed (this is called Tombstoning), then it will get reloaded if you get back to it. It could reactivate on the other pages, but not on Favorites. It's becoming a known error, with 3 pivot pages it's perfect, but if you have 4 (or more) then on the third page reactivation will be fatal if you try to select your active pivot page in the OnNavigatedTo event handler, where it would be perfect because you couldn't see the first page popping in for a moment. Bit daft... Hopefully it will get fixed someday.
At this point I already had localized text on the user interface, showing Hungarian text if that's the selected system language, it will be supported by Mango so I can prepare for it. But there is a way to localize the application title and tile title too, so in order to make the app as good as it could be, I solved this issue, I even made a tool to help with this task in the future. And since I was there, I added the ability of selecting the user's own default language, even before the Hungarian language gets supported in the system.
Cherry on top of the sundae, I created the Windows Phone version of Moonbase, my class library of reusable functions helping out with often needed stuff like localization, file management in isolated storage, Style / Brush / Font selection, theme detection and whatnot. It will come handy in my next app.
Go and check out the app if you need such a thing, or just try it out for the fun of it; it's free!
![]() | Windows Phone Marketplace website |
If you're not familiar with Windows Phone, take a glimpse at its look and feel... Lovely, isn't it?









