Saturday, March 03, 2001 ..:: Home ::.. Register  Login
   TechTidBits (Blog)  

Good news/bad news about WP7 Task objects

Apr 7

Written by:
Wednesday, April 07, 2010 9:26 PM  RssIcon

WarningTonight I learned about 10 very cool "Task" objects you can use with your WP7, but you cannot use them with the emulator.  Read on for more details.

WarningTonight, I ran into my first instance I really, Really, REALLY want a WP7!  The real deal!  The actual hardware, and actual phone I can plug in with USB, something I can actually touch to try STUFF out on.  Device hardware I can deploy my app to in order to test it.  Why?  Well, tonight I read about ten very cool and potentially mind blowing "Task" objects (thank you Rudi Grobler for the info!) which in three lines of code, namely things like:

  1. Bing maps
  2. Camera capture
  3. Email address chooser
  4. Opening the Marketplace
  5. Opening up music/vids
  6. Making a call
  7. Saving an email address
  8. Bing searches
  9. Composing SMS messages
  10. Accessing a web browser

Yup, in three lines of code you can open up Bing Search

SearchTask search = new SearchTask();
search.SearchQuery = "Privasoft";

Launching the Marketplace is even easier with ONE line of code

MarketplaceLauncher.Show(MarketplaceContent.Applications, MarketplaceOperation.Open);

The only problem is, when I do these things, I get a COMException error pointing to some cryptic file now found errors.  Uhm.......I would have thought this kind of thing should have been detected BEFORE I can get to the point of running the actual code in the emulator, no?  Below, you'll see the lines of code which will generate the error and the actual screen cap of the COMException I got.

Exception and code that generated it

I Googled the exact error and an MDSN link came up, looks like a good candidate right?  hhhmmmmm uuuuuhhhhh......hhhmmmmmm

MSDN Error Message

Floppy disk?  Really?  I haven't owned a computer with a FLOPPY disk for over TEN YEARS!!!!!!!!!!  WTF?  Me thinks THAT doc is a bit stale?

I haven't tried ALL of the "Task" objects but the WebBrowser is the only one that works so far.  Now that one is VERY cool, you get all the cool things you'd expect in your browser including automagical Back button support without any NavgationService.Navigate() stuff. The code for doing this magic is exceptionally simple!

WebBrowserTask browser = new WebBrowserTask();
browser.URL = "";

And then you'll get a browser "in your app" (or more accurately, FROM your app) for free!  No including some Microsoft.Phone.Controls.WebBrowser Reference, no extra WebBrowser user control on a page, just three lines of code.  Simple eh?


Now, I know the COMException thing is just a fluke, well, I HOPE it's a fluke and it'll just get fixed soon enough.  Until then, steer clear of them until you get a phone (which I really Really REALLY hope is SOOOOOOOOOOOOOOON!!!!!!!!!!!!!), until then, it's time to grab a coffee and get coding! 



Rudi Grobler: And it can make phone calls...

MSDN: Error Message

Location: Blogs Parent Separator TechTidBits

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Add Comment   Cancel 
Copyright 1999-2012 by   Terms Of Use  Privacy Statement