Shiny Silverlights

...Another Silverlight MVP blog

Windows Phone

...now browsing by category

 

Ten Awesome Apps from 1st Windows Phone Code Camp in Riga

Wednesday, December 7th, 2011

Like couple of weeks before in Tallinn (http://h6bevalge.riiul.com/2011/11/22/kumme-vinget-rakendust-esimesest-wp-koodilaagrist/) this weekend me, Agu, Jevgeni and Valdis, powered by Microsoft, organized an awesome Windows Phone code camp in Riga at SSE Riga school. The idea behind the event was to introduce the platform and create some awesome local apps to boost the app ecosystem in Latvia.

The schedule was quite intense. On the first day we had three coding lectures Agu talked about the importance of design and the Metro design language; I gave a quick intro to Windows Phone dev and data binding and finally Jevgeni had the pleasure of talking about almost everything else possible in WP in his “Limitless possibilities of Windows Phone” session. Then we had some lunch and starting from 2 PM Saturday, the teams started coding.

During the weekend total of 10 apps were made.

  • V?rda diena (Latvian namedays) is an app that gives you a calendar with Latvian namedays by day, week or you can search for a name. Coolest feature is the Live Tile, that sitting on your start screen always shows you the names who have the name day today and it was hinted that in the future you might see the tile going alert red if someone in your contacts has a name day :)
  • Alphabet Ninja (XNA and SL versions) – Alphabet ninja aims to teach children in ages from 3-5 to learn letters in playful way by recognizing them on the screen. To score in the game you need to tap on letter bubbles that are the same as the template shown by the game. Cool graphics and sound effects, and of course ninjas :)
  • Alphabet Ninja the Level 2 – Though Alphabet Ninja team made both XNA and Silverlight versions of their game, they didn’t stop there, they also created a level two for the game in Silverlight. Idea behind the game was to find certain letters from the grid and tap them. The fact that the letters might both be in upper and lower case or use different fonts adds some difficulty to the game.
  • Phone Mouse (Telefon pele) is an utility to control your computer from your phone. To move the mouse cursor, you can either use your phone as a touchpad or wave it in air. You can also us the phones keyboard. Cool utility for all Media Center PC owners.
  • Baltic Rain shows you a live map of rain in Baltics. Simple as that. Take a look at the map, see rain coming? Maybe start running to avoid getting wet ;)
  • Puzzles – is a fun set of mind games 15 puzzle, word game and Bulls and Cows.
  • E-Vielas is an app for understanding what you eat and drink. You scan the barcode on the product and it tells you what e-substances it contains. The data comes from an excisting crowd sourced database and currently has about 5000 Latvian products in it.
  • Mobilly is a way to simplify mobile parking. Choose the zone you’re in and the parking sms message is automatically created for you, all you need to do is send it. Future versions also include reminders to turn off the parking after you leave the parking lot.
  • Transport in Riga is the winning app. It allows you to see the schedule of all the different public transport, see the routes on the map. You can also ask the app to remind you in enough time so you’d make the last bus. If you speak latvian, you can read more about the app from Ram?ns blog here http://ramuuns.id.lv/blog/2011/12/06/ka-nopelnit-12k-latu-divas-dienas/.

Here are some screenshots from the winning app

You can see more photos from the event on Dotnet.lv Facebook page: https://www.facebook.com/media/set/?set=a.299668240063656.72039.161626433867838&type=3

The organizing team was really impressed how driven and motivated everyone was to make great apps and we sure hope to organize such an event again soon. Maybe Vilnius is next?

P.S

Also check out Windows Phone App Competition. Deadline for app submission in both Latvia and Estonia is December 11. The prizes are excellent Windows Phone devices and free ad rotation for your app. I am sure that many apps that were created during code camps will be submitted :). Read more on: http://microsoft.lv/wp

 

WP7 caretIndex

Thursday, June 2nd, 2011

In a recent project of mine, I needed to programmatically change the position of the caret in TextBox. Sadly I realized that Windows Phone 7 TextBox doesn’t have the caretIndex property. No worries, you can achieve the same with TextBox.Select().

To move carret to the end of text in TextBox, just use:

textBox.Select(textBox.Text.Length, 0);

Windows Phone 7 and iPhone – Views and navigation

Friday, August 20th, 2010

On the iPhone your application lives within one UIWindow, your content is shown within an UIViewController. Navigation is established using an UINavigationController – a specialized view controller that manages the navigation of hierarchical content. It’s like a stack to where you push new UIViewControllers to be shown on screen and pop them when they are no longer needed.

On Windows Phone, applications live within one Frame object, like on the iPhone, Frame represents a logical area for your content – Page controls. Frame also exposes properties like device orientation, area where to render Page contents etc.

Navigation

Navigation between Pages in Windows Phone apps resemble navigating the web with GET parameters.

To move to the next Page:

  1. NavigationService.Navigate(new Uri("/SecondPage.xaml?msg=" + textBox1.Text, UriKind.Relative));

And the Page that is navigated to can catch the event and do needed initializations:

  1. protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) {
  2.     base.OnNavigatedTo(e);
  3.     string msg = "";
  4.     if (NavigationContext.QueryString.TryGetValue("msg", out msg))
  5.         textBlock1.Text = msg;
  6. }

To move back to previous Page user could click the hardware back button or we could programmatically call:

  1. NavigationService.GoBack();

On the iPhone there are two ways to navigate between pages. You would either push a new UIViewController to the navigation stack using pushViewController:animated:

Or present a UIViewController modally using presentModalViewController:animated:

You can think of a modal view as a pop-up window, something temporary, like a login form or showing terms of service.

Transitions

For modal views you get a limited number of transition styles:

  1. typedef enum {
  2.    UIModalTransitionStyleCoverVertical = 0,
  3.    UIModalTransitionStyleFlipHorizontal,
  4.    UIModalTransitionStyleCrossDissolve,
  5.    UIModalTransitionStylePartialCurl,
  6. } UIModalTransitionStyle;

Using the default pushviewcontroller:animated: method you are always stuck with right to left appearance of a new view. But you can basically customize the transition by disabling the default animation and creating your own.

It’s the same story on Windows Phone, by default there is no animation between transitions from one Page to another but you can create your own. You use two animations, one on the initial page and another on the page you are navigating to.

Jeff Brand says it best on his great blog post about Page transitions:

The most common solution to this problem is to use brute force and manage the transitions yourself. You commonly see a “pattern” used in WP7 apps where events in your current page launch a Storyboard animation. When that animation is complete, the actual navigation to the new page is invoked and the new page then runs its own Storyboard once it is loaded. It looks something like this…

Jeff Brand, Simplify Page Transitions in Windows Phone 7 Silverlight Applications

I am not sure if there is such a thing as Modal View on Windows Phone (like on the iPhone), but I think Shawn Wildermuths adaptation of ChildWindow is close enough and you could recreate iPhone like animations if you would want to.

This post is part of a series of comparisons between developing on the iPhone and Windows Phone:

Windows Phone 7 and iPhone – Multitasking

Sunday, August 15th, 2010

For almost two years our company has been developing iPhone applications. As a Silverlight MVP, seeing Windows Phone 7 support Silverlight as a development platform, is like a dream come true. So naturally the first thing to look at is what is different? In this post I’ll look at multitasking.

Multitasking

Multitasking on the Windows Phone

There hasn’t been a lot of talk about multitasking but as I understand, it is quite similar to the iPhone. Applications are in one of two states hydrated (active) or dehydrated (inactive). Developers are encouraged to save and restore application state between different events – closing, deactivationg and activating.

Closing

The application will go to the closing state when the user presses the hardware back button beyond the front page of your application. In here data that is persistent throughout app instances should be saved to isolated storage. You should not save data that is specific to current instance because this instance will never be resumed.

Closing on the iPhone
On the iPhone applications are closed (applicationWillTerminate:) when the user explicitly closes them from the multitasking UI or when the app is running on older systems that don’t support multitasking. Application may also be closed when the state saving is taking too long (> 5 sec).

Deactivating

Windows Phone application will go to deactivated state when the user presses the start-button, the app is killed for saving persistent data too long (10 secs is the max) and when the user is using a Launcher or a Chooser. Application may but might not be resumed after this state.

Application will not be resumed when the user starts a new instance by picking the same app from the app list again, or when many apps are opened in a row and your app could no longer be reached using the hardware back button.

So you are assumed to be saving app state before launching a chooser or launcher.

Deactivating on the iPhone

Multitasking on the iPhone

Multitasking on the iPhone

Apple also has a time-limit for saving application state – 5 seconds. What is different is that Windows Phone deactivates your application when you initialize e-mail sending (use Launchers or Choosers). On the iPhone sending an e-mail is part of your application and only way away from the e-mail app initialized from your app  MFMailComposeViewController is through your app. You get an event that the e-mail composing was finished. The same applies with image and video pickers on the iPhone, but on Windows Phone, you send your user to pick an image, send an e-mail and might never see the user again.

Another difference is that on Windows Phone you can always “restart” an application by starting a new instance of it by choosing it from the application list. On the iPhone when you tap on the icon of a running app you get the running instance of that app not a new one.

Activating

Your Windows Phone app enters the activating state when:

  • the user finished using a Chooser or Launcher.
  • user launched a new app and now pressed the hardware back button enough times to reach your app.

Now your app should restore saved state from PhoneApplication.State and the user should never know that the application stopped running.

Activating on the iPhone

On the iPhone there really isn’t a built in mechanism for state saving, you get the events applicationWillResignActive:, applicationDidEnterBackground: and applicationDidBecomeActive: but within those it is really your task to somehow save the state.