lunedì 24 settembre 2012

Windows Phone - Settings Page in 5 minutes

The best user experience for a settings page is: stay away from the save button.

People don't love to press the back button and lose all settings. Then it's better to save when the user does something.

Thanks to Jerry Nixon you can use this code and have a base framework for all your applications.

    public static bool EnableLocation
    {
        get { return Get("EnableLocation", false); }
        private set { Set("EnableLocation", value); }
    }

    public static event PropertyChangedEventHandler SettingChanged;

    private static T Get<T>(string key, T otherwise)
    {
        try
        {
            return (T)IsolatedStorageSettings.ApplicationSettings[key];
        }
        catch { return otherwise; }
    }

    private static void Set<T>(string key, T value)
    {
        IsolatedStorageSettings.ApplicationSettings[key] = value;
        if (SettingChanged != null)
            SettingChanged(null, new PropertyChangedEventArgs(key));
    }

The code is very easy:
  • the "Get" function return the default value if the key don't exists.
  • the "Set" function uses an event to immediatly reflect changes into your apps.
  • the functions use "Generics".

Enjoy!

sabato 15 settembre 2012

myMoneyBook for Windows Phone

"myMoneyBook" is an easy way to manage your personal finances. You can customize catogories according to your needs, and set a monthly budget to keep track of what you spent. The dashboard summarize the balance with simple indicators and have two big tiles to speed up your operations.
All screens are in perfect Windows Phone style.
It's possible to set your privacy with a password.

There is a fast option to backup and restore all data via SkyDrive, and to export the records in file .csv.


The landscape mode show customizable and zoomable charts for detailed statistics.


"myMoneyBook" offers also customizable live tile:
  • Change image
  • Enable budget alert
  • Show today balance
  • Show monthly balance
  • Show total balance

At moment myMoneyBook is translated in Italian, English and Czech language.



More screenshots:


giovedì 13 settembre 2012

Windows Phone - Live Tiles with Telerik

The default Windows Phone framework offers a simple template for tiles:
  • Static background image from application or from url.
  • Title.
  • Number (top right).
  • A back message.

With Telerik RadControl for Windows Phone you have more power in your hands!


myWeather

"LiveTileHelper" class helps you to create dynamic live tiles with your own design and your own content.

The "RadExtendedTileData" extends the standard tile data with two properties VisualElement and BackVisualElement.
Now the amazing thing: this properties accept UIElement. Yes, UIElement!!

Now let's code...
LiveTileHelper.CreateOrUpdateTile( 
 new RadExtendedTileData() 
 { 
  Title = "My front title",
  VisualElement = new MyUserControl(),
  BackTitle = "My back title" 
  BackContent = "My back message", 
  BackVisualElement = new MyUserControl2(), 
 }, 
 new Uri("/MainPage.xaml?param=myparam", UriKind.RelativeOrAbsolute)
);

You can customize MyUserControl and MyUserControl2 as you want, the only limit is your imagination.

Then, why should you use this controls?
  • Easyness
  • More features
  • Time saver
  • Support and help

And remember this: a good app, has a good live tile.

sabato 8 settembre 2012

Windows Phone - Low memory devices

SDK 7.1.1 includes features specifics to developing for 256MB devices (Nokia Lumia 610 and others).

Low memory devices have some limitations, then you need to check the memory size and if needed, disable some features to target the largest possible market.

First, you need this MemoryHelper:
public static class MemoryHelper
{
 public static bool IsLowMemDevice { get; set; }

 static MemoryHelper()
 {
   try
   {
     Int64 result = (Int64)DeviceExtendedProperties.GetValue("ApplicationWorkingSetLimit");
    if (result < 94371840L) IsLowMemDevice = true; else IsLowMemDevice = false;
   }
   catch (ArgumentOutOfRangeException)
   {
     //windows phone OS not updated, then 512mb
     IsLowMemDevice = false;
   }
 }
}

Now you can easy detect device type:
if (MemoryHelper.IsLowMemoryDevice)
 // do some work


Tips:
  • PeriodicTask and ResourceIntensiveTask classes are not supported to 256MB phones. This background agents throw an exception if you try to schedule them on this devices.
  • Check your app with Windows Phone Memory Profiler (it is included in VS2010).
  • Use WebBrowserTask instead of the <WebBrowser /> control to display web pages.
  • Use BingMapsTask instead <Map /> control.
  • Consider to reduce image quality and reduce the number of the animations.
  • Avoid long lists of data. The best practice is to use data virtualization.
  • Consider to disable page transitions.
  • Remember to test your application with all two emulators!

giovedì 6 settembre 2012

Windows Phone - Keyboard suggestions

In Windows Phone standard apps (like mail and messaging), when you enter a text, you will see the list of suggestions for the text you are typing.

In your app, every Textbox has the ability to have an InputScope assigned to it.

XAML:
<TextBox InputScope="Text" /> 
 
InputScope help the developer to assign also the good keyboard for the context:
 
  • URL: this keyboard gives you a ".com" button to finish typing your URLs, but that button, with a long-tap, will also expand to show you .net, .org, .edu, and .co.uk.
  • TelephoneNumber: it gives the user a numeric dial pad instead of an alphabetic keyboard.
  • EmailNameOrAddress: it gives a period, an @ symbol and ".com" button.

You can find more InputScopeNameValue enumerator on MSDN.

Windows Phone - Share Status Task

Microsoft made available to developers some Launchers and Choosers.
Now is very easy to share your status in the most popular social networks with a simple code:

ShareStatusTask shareStatusTask = new ShareStatusTask();

shareStatusTask.Status = "Hello, today is a great day";

shareStatusTask.Show();