Silverlight

Windows Phone Development–Choosers and Launchers

April 17, 2012 .NET, All, C#.NET, Microsoft, Microsoft SDKs, Mobile-Development, Silverlight, Silverlight SDK & Tools, VisualStudio, VS11, VS2010, Windows, Windows 7, Windows Phone, Windows Phone "Mango", Windows Phone 7, Windows Phone 7.0, Windows Phone 7.5, Windows Phone Development, Windows Phone SDK No comments

While doing windows phone application programming you will come across some requirements such as:

a. “Selecting a contact from contact book”

b. “Open up Camera, take a photo and upload or use the photo”

c.  “Open a link in Web Browser”

How you can achieve these typical tasks?

Answer is pretty simple Windows Phone SDK provides a set of API’s or classes you can use to perform these tasks easily.

You can use Launchers and Choosers in your Windows Phone applications to enable users to perform common tasks. By using Launchers and Choosers, you help provide a consistent user experience throughout the Windows Phone platform.

1. Launchers – are certain task API’s that would invoke a built in Application on Windows Phone.

For Example: ‘opening a link on Phone Browser’. Launchers API available with Windows Phone SDK will simplifies the task of implementing such a feature from the scratch.

Some of the Launchers provided by Windows Phone SDK are:

  • Bing Maps Direction Task
  • Bing Maps View Task
  • Connection Settings Task
  • Compose Email Task
  • Market Place Details View Task
  • Market Place Hub Task
  • Market Place Review Task
  • Market Place Search Task
  • Media Player Task
  • Phone Call task
  • Search Task
  • Share a Link Task
  • Share Status
  • SMS Compose
  • Web Browser Task

[More detailed reference use MSDN on Reference on Launchers for Windows Phone]

2. Choosers – are certain task API’s that would invoke a built in Application on Windows Phone and after completing the task it would return the result through application call back methods.  When the new application appears, the user can choose to complete or cancel the task. When the user closes the new application, the calling application is usually reactivated and supplied with data and status.

 For Example: “Selecting a contact from Address book and sending a mail to it”. or “Launching camera application and taking a photo and stores it back on the application”.

Some of the Choosers provided by Windows Phone SDK are:

  • Address Chooser Task
  • Camera Capture Task
  • Email Address Chooser Task
  • Game Invite Task
  • Phone Number Choose Task
  • Photo Chooser Task
  • Save Contact Task
  • Save Email Address Task
  • Save Phone numbers task
  • Save Ringtone Task

Using Choosers and Launchers

Implementing Launchers and Choosers are pretty simple. Most of the launchers and choosers are available within namespace “Microsoft.Phone.Tasks“.

a. To use a Launcher follow the below general steps:

  1. Create an instance of the task type for the Launcher.
  2. Set any required and optional properties of the task object. These determine the behavior of the task application when it is invoked.
  3. Call the Show method of the task object.

Example:

The below example will open a Phone Web Browser with url https://google.com

  private void TestWebBrowserChooser()
        {
            WebBrowserTask webBrowserTask = new WebBrowserTask();
            webBrowserTask.Uri = new Uri("https://www.google.com");
            webBrowserTask.Show(); 
        }

b. To use a Chooser follow the below general steps:

  1. Create an instance of the task type for the Launcher.
  2. Identify the callback method to run after the user completes the task.
  3. Set any required and optional properties of the task object.
  4. Call the Show method of the task object.
  5. Implement the completed event handler to capture data and status after the user completes the task.

Example: (Below example will launch address book and when user completes selecting an address, the call back will happen and data will be passed on to your application)

 private void TestAddressBookChooser()
        {
            AddressChooserTask addressChooserTask = new AddressChooserTask();
            addressChooserTask.Completed += new EventHandler<AddressResult>(addressChooserTask_Completed);
            addressChooserTask.Show();
        }

        void addressChooserTask_Completed(object sender, AddressResult e)
        {
            Debug.WriteLine(e.Address);
            Debug.WriteLine(e.DisplayName);
            
            //throw new NotImplementedException();
        }

Pretty simple isn’t it.

But there are few important concepts you need to understand when implementing launchers and choosers.

  1. When using Launchers and Choosers, is that the calling application is either put into a dormant state or tombstoned when another application is launched.
  2. When the new task application is launched, your application is deactivated and is no longer running.
  3. Usually, your application is put into a dormant state by the operating system.
  4. After completing the task, the user can return to your application that was preserved in memory, and it resumes in the same state as before the new application was launched.
  5. However, it is also possible that your application may be terminated by the operating system. In this case, if the user returns to your application, it is a new instance, and the state of your application is not automatically restored.

Hope you enjoy this post. Will write more soon, keep reading it.

References: 

http://msdn.microsoft.com/en-us/library/ff769550(v=vs.92).aspx

http://msdn.microsoft.com/en-us/library/ff769543(v=vs.92).aspx 

http://msdn.microsoft.com/en-us/library/ff769543(v=vs.92).aspx

10 Laps around Silverlight 5-Silverlight Show Series by Michael Crump

December 11, 2011 .NET, .NET Framework, All, General, Microsoft, Silverlight, VisualStudio, VS11, VS2010 No comments

Read this Silverlight 5 learning series by Michael Crump

1) Introduction to SL5  – This post which provides a brief history of Silverlight and relevant links.

2) Binding – Ancestor Relative Source Binding and Implicit Data Templates.

3) Graphics -XNA 3D API and Improved Graphics Stack.

4) Media – Low-Latency Sound using XNA and Remote Control and Media Command (Keys) Support.

5) Text – Text Tracking and Leading, Linked and Multi-column Text, OpenType Support, Pixel Snapped Text and TextOptions.

6) Operating System Integration Part 1 – P/Invoke, Multiple Windows and Unrestricted File System Access in Full Trust.

7) Operating System Integration Part 2 – Default Filename for SaveFileDialog, 64-bit browser support and Power Awareness.

8) Productivity and Performance – XAML Binding Debugging, Parser Performance Improvements and Multi-core JIT for improved start-up time.

9 Controls – Double and Triple click support, PivotViewer and ComboBox Type-Ahead.

10) Other items – In-Browser HTML, PostScript and Tasks for TPL.

Happy Coding!!!

Silverlight 5 Final(RTW) released and Microsoft® Silverlight® 5 Tools for Visual Studio® 2010 SP1 available for download

December 10, 2011 .NET, .NET Framework, All, ASP.NET, ASP.NET MVC, C#.NET, Frameworks, General, IIS, IIS 7.5, Microsoft, Silverlight, VB.NET, VisualStudio, VS2010 No comments

In DECEMBER 2010 Silverlight Fire starter  event Microsoft announced the upcoming release of  Silverlight 5.  Read Scott GU’s Silverlight 5 -announcement blog. and right after an year, yesterday Microsoft has made a remarkable announcement for developers by Releasing final version of Silverlight 5 (RTW).

Silverlight 5 offers many new features including:

For a detailed list of the new features see the Silverlight content on MSDN, specifically, the What’s New for Silverlight 5 link.

and http://10rem.net/blog/2011/12/09/announcing-the-release-of-silverlight-5 

 

Microsoft® Silverlight® 5 Tools for Visual Studio® 2010 SP1

is an add-on for Visual Studio® 2010 SP1 to provide tooling for Microsoft® Silverlight® 5 and Microsoft® WCF RIA Services V1.0 SP2 . It can be installed on top of either Visual Studio® 2010 SP1 or Visual Web Developer 2010 Express Service Pack 1. It extends existing Microsoft® Silverlight® 4 features and multitargeting capabilities in Visual Studio® 2010 SP1 to also create applications for Microsoft® Silverlight® 5 using C# or Visual Basic.
This download will install all components necessary for Microsoft® Silverlight® 5 and Microsoft® WCF RIA Services V1.0 SP2 development:

  • Silverlight 5 Developer Runtime
  • Silverlight 5 SDK (software development kit)
  • Update for Visual Studio 2010 Service Pack 1 and Visual Web Developer Express 2010 Service Pack 1 (KB2502836)
  • Microsoft WCF RIA Services V1.0 SP2

Download Microsoft® Silverlight® 5 Tools for Visual Studio® 2010 SP1

   Other Silverlight related Downloads:

Silverlight 5 Tools for Visual Studio 2010 SP1
Silverlight 5 Developer Runtime for Mac OSX (32 bit)

Silverlight 5 Toolkit
Silverlight 5 Developer Runtime for Windows (32 bit)
Service Pack 1 for Visual Studio 2010

Silverlight 5 Developer Runtime for Windows (64 bit)
Web Platform Installer

How to Download MIX 2011 Videos

April 19, 2011 .NET, .NET Framework, All, ASP.NET, ASP.NET MVC, Azure, General, Microsoft, Silverlight, VB.NET, VisualStudio, VS2010, WCF, Windows, Windows 7, Windows 8, Windows Phone No comments

Scott Hanselman has shared a nice article on how to download the videos of MIX2011 – Conference LAS VEGAS, happened last week.

These are good presentations about Windows Phone 7,  MVC, Silverlight 5, XBOX, and Azure.. Don’t miss it!!

Read through the link Mix 2011 Videos – article by Scott Hanselman

Thanks Scott!! for such a nice article as well as informative sessions by you in Mix 2011 Videos..

Silverlight 5 Beta Released & Microsoft Silverlight 5 Beta Tools for Visual Studio 2010 Service Pack 1

April 14, 2011 .NET, .NET Framework, All, General, Microsoft, Silverlight, VisualStudio, VS2010 No comments

Microsoft has just released first beta of upcoming Silverlight 5.

Microsoft Silverlight 5 Beta Tools for Visual Studio 2010 Service Pack 1 is an Add-on and pre-requisite files for Visual Studio 2010 Service Pack 1 to develop Silverlight 5 Beta and Microsoft WCF RIA Services V1.0 SP2 Preview (April 2011) applications.

Download: Silverlight 5 Tools Beta

Microsoft® Silverlight™ 5 Software Development Kit Beta

Silverlight 5 Beta Documentation

Getting Started with Silverlight 5 Beta

Learning Silverlight and WCF RIA Services

January 30, 2011 .NET, .NET Framework, All, DataServices, General, Microsoft, RIA Services, Silverlight 1 comment

I came across a nice blog on Silverlight and WCF RIA Services by Mike Taulty from Microsoft UK. Thought of sharing it with you.

Just read through it in free times.

Silverlight and WCF RIA Services (1 – Overview)

 Silverlight and WCF RIA Services (2 – Services)

 Silverlight and WCF RIA Services (3 – Client)

 Silverlight and WCF RIA Services (5-Authentication)

Happy Coding!!!