Contact Windows Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Sunday, 4 November 2012

Windows 8 - Images and DPI

Posted on 14:13 by Unknown
Windows 8 is DPI aware then the applications auto-scale images according to DPI and screen resolution:
  • 100% when the scale is not applied.
  • 140% when the screen resolution is 1920x1080 and for all devices with minimum 174 DPI.
  • 180% when the screen resolution is 2560x1440 and for all devices with minimum 240 DPI.

The developer can use vectorial elements like SVG or XAML without problems.

Otherwise when the developer uses the images raw, bitmap, png or jpg, he needs to create a file for every case.

He can explicit the scale factor in the file extension:
\myLogo.scale-100.jpg
\myLogo.scale-140.jpg
\myLogo.scale-180.jpg

Or use the folder convention:
\scale-100\myLogo.jpg
\scale-140\myLogo.jpg
\scale-180\myLogo.jpg

When the application don't has static images, it's possible to create a logic to have the same result from code behind.
switch (DisplayProperties.ResolutionScale)
{
case ResolutionScale.Scale100Percent:
img.Source = new BitmapImage(new Uri("url?s=100"));
break;
case ResolutionScale.Scale140Percent:
img.Source = new BitmapImage(new Uri("url?s=140"));
break;
case ResolutionScale.Scale180Percent:
img.Source = new BitmapImage(new Uri("url?s=180"));
break;

default:
// some exception
}

The class DisplayProperties has some event to help the developer:
  • ColorProfileChanged: when the color profile changes.
  • LogicalDpiChanged: when the the pixel per inches (PPI) changes.
  • OrientationChanged: when device orientation changes.
  • StereoEnabledChanged: when the property StereoEnabled changes (3D stereoscopic).


Read More
Posted in c#, csharp, developers, microsoft, silverlight, windows 8, windows RT | No comments

Sunday, 28 October 2012

Windows Phone - Localization

Posted on 05:09 by Unknown
When you publish a Windows Phone application in the Marketplace, you have more visibility if you support the region language.

An easy way to build a localized app is to use resources file (.resx).

First of all remember to set the default "neutral" language in the project properties! This is an important step because the "AppResources.resx" file is used from all not specified languages.

Add new file, and name it "AppResources.resx" for default language. For a new language, just add a new resource named with the CultureInfo ISO letters:
  • AppResources.it-IT.resx for italian language.
  • AppResources.cs-CZ.resx for czech language.
  • AppResources.fr-FR.resx for french language.
  • etc..
Remember to set all resource files to the public access modifier.



Now unload your project and edit the csproj file to add your supported language:
<SupportedCultures>it-IT;en-US;cs-CZ;fr-FR</SupportedCultures>

Create a class to get your resources.

public class LocalizedStrings
{
private static AppResources localizedResources = new AppResources();

public AppResources Strings
{
get
{
return localizedResources;
}
}
}

In your xaml you need to declare your class as resource:
<phone:PhoneApplicationPage.Resources>
     <local:LocalizedStrings x:Key="LocalizedStrings"/>
 </phone:PhoneApplicationPage.Resources>

Now you can use your localized string like this:
Text="{Binding Strings.Loading, Source={StaticResource LocalizedStrings}}"
Or from code behind:
txtLoading.Text = AppResources.Loading;

To test your app you can insert this code in application launching event:
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("it-IT");
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("it-IT");

All CultureInfo codes here.
Read More
Posted in c#, csharp, developers, hot, microsoft, silverlight, tips, windows phone | No comments

Friday, 19 October 2012

Windows Phone - Get Album Art

Posted on 14:45 by Unknown
When you use MediaPlayer class in Windows Phone, usually you want to get the album cover for the current song.
You can access the current track with the ActiveSong property. This property is exposed by the Queue of MediaPlayer. Then you can check out the album art.

This code is all you need:

if (MediaPlayer.Queue.ActiveSong.Album.HasArt)
{
BitmapImage bmp = new BitmapImage();
bmp.SetSource(MediaPlayer.Queue.ActiveSong.Album.GetAlbumArt());
imgAlbum.Source = bmp;
}
Read More
Posted in c#, csharp, developers, microsoft, music, silverlight, tips, windows phone, xna | No comments

Saturday, 6 October 2012

Equality Comparer with Lambda

Posted on 07:03 by Unknown
Today, it's normal to write code with LINQ and Lambda Expressions.
But when you need to use IEqualityComparer, it's not possibile to use a lambda predicate.
The Interface needs a class, then you have to create a new type that inherit from IEqualityComparer.

You can use this workaround:
 
public class EqualityComparer<T> : IEqualityComparer<T>
{
  private Func<T, T, bool> _fnEquals;
  private Func<T, int> _fnGetHashCode;
   public EqualityComparer(Func<T, T, bool> fnEquals, Func<T, int> fnGetHashCode)
  {
   _fnEquals = fnEquals;
   _fnGetHashCode = fnGetHashCode;
  }
   public bool Equals(T x, T y)
  {
   return _fnEquals(x, y);
  }
   public int GetHashCode(T obj)
  {
   return _fnGetHashCode(obj);
  }
}

The simple usage is:

 
Dictionary<int, string> d = new Dictionary<int, string>() { { 1, "a" }, { 2, "a" }, { 3, "b" } };

var d2 = d.Distinct(new EqualityComparer<KeyValuePair<int, string>>((kvp1, kvp2) => kvp1.Value == kvp2.Value, kvp => kvp.Value.GetHashCode()));
Read More
Posted in c#, csharp, developers, lambda, microsoft, tips | No comments

Monday, 24 September 2012

Windows Phone - Settings Page in 5 minutes

Posted on 13:34 by Unknown
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!
Read More
Posted in c#, csharp, developers, microsoft, silverlight, tips, windows phone | No comments

Friday, 14 September 2012

myMoneyBook for Windows Phone

Posted on 15:16 by Unknown
"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:


Read More
Posted in appdeals, apphub, c#, csharp, developers, marketplace, microsoft, moneybook, mymoneybook, silverlight, windows phone | No comments

Thursday, 13 September 2012

Windows Phone - Live Tiles with Telerik

Posted on 11:38 by Unknown
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.
Read More
Posted in c#, csharp, developers, hot, microsoft, silverlight, telerik, tips, windows phone | No comments
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • XMAS TIME - Get a Lumia 925 for free
    Do you want a Lumia 925 for Christmas? Thanks to DVLUP you can get it easy :) Check the new xmas challenge ! You just need to create 3 new ...
  • On Mobile and Elections
    It's election day! Once you've found  where to vote  and made your voice count, you'll probably want to see how the rest of the ...
  • Our 5 favourite new Windows Phone apps of the week
    Today myMoneyBook is featured in Nokia's blog:  Our 5 favourite new Windows Phone apps of the week . Thank you so much  Nokia !
  • From the desert to the sea: Google Voice Search experiments
    (Cross posted from the Google Australia Blog ) As an engineer I like to solve problems and I like to test stuff, the bigger the better. A co...
  • Happy New Year!
    Posted by Lawrence Chang, Product Marketing Manager, Google mobile team When I first asked the mobile team to send me pictures of how they r...
  • Unwrapping Ice Cream Sandwich on the Galaxy Nexus
    (Cross-posted on the Official Google blog ) Beaming a video with a single tap or unlocking a device with only a smile sounds like science fi...
  • Search Gmail & Docs with Google Mobile App on BlackBerry
    In January we updated Google Mobile App for BlackBerry so it can search your on-device email and contacts . Today we’re pleased to announce...
  • orkut for S60, now with photo uploads and picture galleries
    When we launched the mobile (xhtml) version of orkut back in April on m.orkut.com, we were overwhelmed by its adoption. However, Google alw...
  • Windows Phone 8 - Map and Clusters
    This code example demonstrates how to dynamically group pushpins in the map control. There is a lot of code for Windows Phone 7, then I merg...
  • Google Voice for everyone
    (Cross-posted with the Google Voice Blog ) A little over a year ago, we released an early preview of Google Voice, our web-based platform f...

Categories

  • 100th post
  • 3D
  • 6210 navigator
  • 6220 classic
  • adsense
  • adsense for mobile
  • alexandra's mobile [ad]itude
  • Amber
  • android
  • android market
  • android widget
  • app
  • appdeals
  • apphub
  • apple
  • apps
  • att
  • autocomplete
  • best buy mobile
  • better know your mobile
  • biking directions
  • BlackBerry
  • BlackBerry Storm
  • blackjack
  • blogger
  • brightpoint
  • bug
  • buxfer
  • Buzz
  • buzz for mobile
  • c#
  • cab4me
  • Calendar
  • Caliburn
  • canada
  • CES
  • check-in
  • chi-2008
  • clearwire
  • cloud print
  • Clusters
  • Coding4fun
  • Contacts
  • convenience key
  • countdown to 2009
  • coupons
  • csharp
  • culture
  • dennis woodside
  • developers
  • Docs
  • Doodle
  • doodles
  • dotorg
  • doubleclick mobile
  • droid
  • DVLUP
  • e-series
  • ebook
  • election
  • enterprise
  • feature phones
  • france
  • free
  • g1
  • geo
  • geolocation api
  • germany
  • Gesture search
  • gmail
  • gmail for android
  • gmail for mobile
  • GOOG-411
  • googe search
  • Google
  • Google Africa
  • google analytics
  • Google Apps
  • Google Apps Blog
  • google apps device policy
  • google apps for mobile
  • google book search
  • google buzz
  • google buzz for mobile
  • Google Custom Search
  • google docs
  • google earth
  • google finance
  • google gears for mobile
  • google goggles
  • Google I/O
  • google instant
  • google latitude
  • google local search
  • Google Location Alerts
  • google location history
  • Google Locaton History
  • google maps
  • google maps for mobile
  • google maps navigation
  • google mobile
  • google mobile ads
  • google mobile help
  • google mobile help forum
  • Google Mobile Search
  • google mobile tips
  • google mobile tricks
  • google moderator
  • Google News
  • google offers
  • google product search
  • Google profile
  • Google public location badge
  • google search
  • google search app
  • google search by voice
  • google search for mobile
  • google shopper
  • google sites
  • google sky map
  • Google SMS
  • google suggest
  • google sync
  • google talk
  • google toolbar
  • google translate
  • google translate for animals
  • google voice
  • google wallet
  • google+
  • googlenew
  • gps
  • hangouts
  • history
  • honeycomb
  • hot
  • hotpot
  • html 5
  • i-mode
  • igoogle
  • image ads
  • image search
  • inside search
  • Interative web app
  • iOS
  • ipad
  • iphone
  • ipod touch
  • italy
  • iterative web app
  • Iterative Webapp
  • J2ME
  • jason spero
  • lambda
  • latitude api
  • layers
  • Listen
  • Local Business Center
  • local inventory
  • local search
  • locale
  • location based search
  • location tag
  • Lumia 1020
  • Lumia 925
  • mac
  • macworld
  • Mail
  • Maps
  • marketplace
  • mary meeker
  • meow me now
  • microsoft
  • mobile
  • mobile [ad]itude
  • mobile advertising
  • mobile calendar
  • mobile tricks
  • mobile world congress
  • mobile.google.com
  • moneybook
  • motorola
  • movies
  • music
  • MVVM
  • my location
  • my tracks
  • myBattery
  • mymoneybook
  • n-series
  • n78
  • n95
  • n96
  • navigation
  • new york city
  • nexus
  • nfc
  • nokia
  • Nokia Pro Camera
  • NowPlaying
  • ntt docomo
  • NuGet; Visual Studio
  • nyc
  • open handset alliance
  • opera
  • opera mini
  • opera mobile
  • orkut
  • outbox
  • palm
  • palm webos
  • Panoramio
  • personalized suggest
  • Picasa web albums
  • Place Pages for mobile
  • Places
  • Places Directory
  • pre
  • product ideas
  • product search
  • produt search for mobile
  • quick search box
  • Reader
  • registration
  • research
  • s60
  • samsung
  • santa
  • search
  • search by voice
  • Search Options
  • sharing
  • shortcut
  • sidekey
  • silverlight
  • sky lab
  • smart navigation
  • social
  • Sony
  • sony ericsson
  • spain
  • Spreadsheeets
  • sprint
  • sql ce
  • sqlite
  • starring
  • stars
  • street view
  • Summer Games
  • symbian
  • Sync
  • Syncfusion
  • t-mobile
  • tablet
  • tasks
  • TechNet
  • TechNet wiki
  • telerik
  • Thomson
  • TileView
  • tips
  • transit
  • uiq
  • uk
  • universal search
  • verizon
  • visual search
  • voice actions
  • voice search
  • vote
  • walking directions
  • walking navigation
  • web app
  • wep app
  • wikininjas
  • windows 8
  • windows mobile
  • windows phone
  • Windows Phone 7.8
  • Windows phone 8
  • windows RT
  • Windows Store
  • wireless week
  • xaml
  • xna
  • youtube
  • youtube channel
  • YouTube for mobile
  • zoho

Blog Archive

  • ▼  2013 (21)
    • ▼  November (3)
      • XMAS TIME - Get a Lumia 925 for free
      • [ITA] Dal 920 al Lumia 1020
      • Syncfusion TileView - Windows Phone
    • ►  October (1)
    • ►  September (3)
    • ►  August (3)
    • ►  July (2)
    • ►  June (4)
    • ►  April (1)
    • ►  March (1)
    • ►  February (2)
    • ►  January (1)
  • ►  2012 (32)
    • ►  December (2)
    • ►  November (3)
    • ►  October (3)
    • ►  September (6)
    • ►  August (1)
    • ►  June (1)
    • ►  May (2)
    • ►  April (3)
    • ►  March (5)
    • ►  February (5)
    • ►  January (1)
  • ►  2011 (98)
    • ►  December (8)
    • ►  November (9)
    • ►  October (6)
    • ►  September (7)
    • ►  August (2)
    • ►  July (12)
    • ►  June (7)
    • ►  May (11)
    • ►  April (8)
    • ►  March (12)
    • ►  February (9)
    • ►  January (7)
  • ►  2010 (122)
    • ►  December (18)
    • ►  November (10)
    • ►  October (8)
    • ►  September (10)
    • ►  August (10)
    • ►  July (4)
    • ►  June (11)
    • ►  May (7)
    • ►  April (14)
    • ►  March (13)
    • ►  February (10)
    • ►  January (7)
  • ►  2009 (109)
    • ►  December (7)
    • ►  November (14)
    • ►  October (14)
    • ►  September (6)
    • ►  August (7)
    • ►  July (9)
    • ►  June (13)
    • ►  May (10)
    • ►  April (7)
    • ►  March (7)
    • ►  February (11)
    • ►  January (4)
  • ►  2008 (92)
    • ►  December (11)
    • ►  November (7)
    • ►  October (9)
    • ►  September (6)
    • ►  August (6)
    • ►  July (11)
    • ►  June (12)
    • ►  May (4)
    • ►  April (8)
    • ►  March (5)
    • ►  February (5)
    • ►  January (8)
  • ►  2007 (9)
    • ►  December (6)
    • ►  November (3)
Powered by Blogger.

About Me

Unknown
View my complete profile