FeedAgg.com Logo
Your Account | Sign In | Sign Up

Add Feed | Search | Home | Help | Contact | Blog

Feed: Channel 9 - AggScore: 71.5



Summary: Channel 9


Channel 9 keeps you up to date with the latest news and behind the scenes info from Microsoft that developers love to keep up with. From LINQ to SilverLight – Watch videos and hear about all the cool technologies coming and the people behind them.

Interactive Panel: Ask Us Anything!


To end the event, why not have all the speakers on stage to answer any questions you may have, ones that formed as your mind was bent over the last 48 hours. Here are some C++ titans in front of you - what are you going to ask them? What do you want to know? Ask the GoingNative 2012 speakers anything (within reason and subject to destruction by the moderator Smiley ). There should be lots to talk about. Don't be shy!

This is an interactive panel. This means you, the attendee in the room or online, will be first class members of the conversation - you drive it. You ask the questions. The theme has been provided. Where do you want to take it? It's up to you.

Date Published: Jan 15, 2012 - 12:35 pm



Developer Diaries: Mangesh Deshpande


This is the first of a series of videos where we will follow developers as they take the steps to give their Windows Phone applications make-overs. Our first guinea pig is Mangesh Deshpande and he needed some design tips and tweaks to take his app, "Meal Nirvana" to the next level. He met with our design team and resident expert, Arturo Toledo and has begun the redesign work. We will check back with Mangesh every now and then to track his progress. Please feel free to make suggestions as this is meant to be interactive and he welcomes your tips and thoughts as well.

The final application will be revealed in a new show we are launching called "Amp up your Apps". We will also be accepting nominations for apps of yours that you think could use a bit of a make-over.

Enjoy!

 

Date Published: Feb 16, 2012 - 1:14 pm



Defrag: Mem Cleaners, Syncing Favorites, Batch Image Resize


Microsoft tech troubleshooter extraordinaire Gov Maharaj and I help walk you through troubleshooting solutions to your tech support problems. If you have a problem you want to send us, you can use the Problem Step Recorder in Windows 7 (see this for details on how) and send us the zip file to DefragShow@microsoft.com. We will also be checking comments for problems, but the email address will let us contact you if needed.

Advance apologies for the audio quality, the error has since been corrected but too late to solve for this episode.

[00:30] - Follow up question about memory cleaner.
[02:36] - Network connectivity dropping in Windows 7.  
[06:15] - Question about RAID setup.  [link]
[11:50] - How do you sync favorites across PC's?
[13:00] - Is there a log to know which file you just deleted?
[15:30] - Process for batch resizing of images. [link]
[19:00] - How to disable Tablet PC Input Panel. [link]
[20:00] - Can VS perf be helped by installing on an SD card?
[22:50] - Crowdsource Ask of the Week: Extracting file from archive with bad volumes.
[26:53] - Silent install of a printer file.
[28:33] - Required priv for making a text file in C:.
[29:09] - Pick of the Week: Sterling engine seen running on the desk. [link, link, link]

Date Published: Feb 15, 2012 - 3:37 pm


The Big Dimmer Switch


Today, we're introducing Vector. It's a blog about developers, platform, and big ideas/trends in tech, but with a little bit different bent on what folks are used to from Channel 9...

It's been eight years since Channel 9 first introduced many of our key engineering folks to the developer community to deliver a transparent view into how we think about the technologies we're working on, the teams doing the work, and the huge community of people in and around Microsoft that are connected to all of it. None of that changes ... the team continues to produce the great content that has personified Channel 9 since 2004. But we're also going to spend some time on a more 'elevated' view of what we're thinking when it comes to our own strategy, our competitors, broad-based industry stuff, and of course the intersection of all of this with business. Sometimes it'll be topical, other times it will just offer commentary on something that people are talking about. We will also have guest posters talking about what they're doing that fits in this vein.

So that brings us to an actual post on something meaningful ... the disruptive impact of the services model on businesses.

- The Channel 9 Team

In 2007, Nick Carr published "The Big Switch," which chronicles the evolution of electricity from being locally-generated by businesses on their factory floors to something we all now consume as a pay-for-what-you-use utility. The book draws parallels between electricity and packaged software as a means to offer up a potential end-state for cloud computing, hence the title ... there will be, the book asserts, a switchover from in-house datacenters to software delivered as a utility, and it's just a matter of time. It's a good book, not steeped in technical jargon but rather a set of thoughtful mappings between these two eerily similar eras of technology disruption.

Nearly five years have gone by since it was first published, and a lot has happened (and not happened) relative to the pace of cloud adoption ... we know a lot more about what motivates companies to push some apps out the door and into public clouds in a hurry, while other apps will take their time, or maybe even continue to run on-premises in so-called private cloud environments. So it begs a bunch of questions: What is the end state for the services disruption? Is it public cloud platforms and SaaS, or a hybrid of public and private cloud deployments, combined with traditional IT? In other words, is the big switch actually more of a dimmer switch, in the sense that it's not just a simple matter of on/off? Are there any other historical lessons or examples of disruption we can draw insight from?


Disruption is a great word ... if you talk to enough developers, IT folks, and industry pundits about services, "disruption" shows up as by far the most-used and (IMO) best descriptor for what's happening in computing today. Scenarios that used to be impractical, uneconomical, and just plain impossible are now fair game for developers to build and deliver, all because of increasingly cheap and abundant resources like compute, storage, and bandwidth, available at scale and on a pay-as-you-go basis. So when people talk about disruption, the shape of its impact on the market is generally assumed by most folks to be one of outright replacement, such as the advent of electricity as a utility, the combustion engine's replacement of the horse-drawn carriage, and digital media's disruption of physical media, to name a few - basically, the end state in which the disruptive technology means buggy-whip obsolescence for the existing technology. But not all disruptions play out this way, and there are more than a few historical examples, my personal favorite being the captivating story of the microwave business. Seriously, it's actually pretty interesting ...

So here's the story (courtesy of Wikipedia):

As we all know, atomic research started in the 1940's for military purposes, but one of the offshoots of it was the discovery that you could actually use microwave radiation to heat food. Like most technology disruptions (including cloud computing), the discovery & development pre-dated mass adoption by many years. In the case of the microwave, the earliest patents were filed by Raytheon just after World War II, and were licensed to Tappan for the first home-use microwave. It was introduced in 1955 and cost over $1,000, but not surprisingly it didn't do well in the market. Raytheon got back into the game by acquiring Amana and introducing the Radarange in 1967 for about $500, and that's really where market adoption began to take shape. In 1971, 1% of US households owned a microwave, and by 1986 it was 25%, and today it's over 90%.

What's interesting here is how the adoption curve was shaped based on the market's education on what you could and couldn't do with this thing. Keep in mind that the value prop of the microwave was time-savings for the subset of cooking tasks for which the new technology could be used. Can you bake a cake with a microwave? They're not ideal for that. Can you thaw out frozen stuff? Yeah, it's great for that. What about broiling a salmon? Well, no. How about reheating leftovers? Yeah, it's perfect for that. Why do sparks fly everywhere when I put metal in it? You should really read the owner's manual. This was all part of what could best be described as a partitioning process ... partitioning what you do in a kitchen between the existing thing and the new thing. How was this process accelerated? It was just outright education, in many cases through print and TV advertising, which were rife with "ideas" about what you could actually cook, but also by shipping microwave cookbooks with the actual units. Some of the recipe ideas were a stretch (Thanksgiving turkey in a microwave?), but over time, people figured it out and knew what they should and shouldn't be cooking with it, and that essentially determined the end state for the disruptive technology: every modern kitchen will generally have both a conventional oven and a microwave.


So what can we learn from this? Allowing for the fact that the oven business and computing are two entirely different animals, the biggest and most obvious parallel is the ongoing education of the market that we're seeing now about which apps are and are not necessarily well-suited to public cloud deployment. In other words, within any business' app portfolio, there are no-brainers for cloud deployment (web workloads, email, collab, CRM, test, HPC, etc.), while other apps and workloads are subjected to more scrutiny, at least for the time being (ERP, mission-critical apps, apps with HBI data, etc.). Every business, no matter how small, has a portfolio of apps, and this process of portfolio portioning is pretty similar to the task-partitioning process that shaped microwave adoption. In the software industry, we see this in business scenarios, in which there's a lot of focus these days on things like PII at massive scale, infrastructure security, data sovereignty, the regulatory environment, and a host of other factors that business folks consider as part of the go/no-go decision on cloud computing.

At any rate, the end state is becoming increasingly clear: businesses end up with a mixed bag of delivery and deployment approaches to deal with the variable needs & complexities of each & every app in their respective portfolios, at least for the foreseeable future. If you pay attention to cloud computing rhetoric in the industry, hybrid cloud is the new black, but for our part, but the answer was there all along. There's an obvious tension between the possibilities afforded by what is arguably the biggest shift in our industry since the advent of client/server, and the practical realities of technology change for businesses that are grappling with this new era of computing. But from a technical strategy standpoint, there is no confusion on our part ... the design point that defines cloud computing is the path forward for app dev: the next set of apps that matter will be designed for scale and elasticity. They'll be resilient, multi-instance, and highly available. Everything we're doing in the platform across Windows Azure and Windows Server is geared toward enabling developers to meet this design point with the new apps they're building.

This means that today's great debate is twofold: a.) where will these new apps run? And b.) where will those existing apps end up? Off-prem in the cloud, or on-prem in the data center? The answer is "yes." And that's really the point ... the discussion about *where* the apps run (and what most people fixate on when they talk about the services disruption) is orthogonal to the discussion about whether it's an app that meets the bar for the cloud design point vs. an n-tier app running in a VM that's really yesterday's design point. Most businesses' portfolio of apps will have both kinds, old school and new school, and they'll be partitioned across off-prem and on-prem. Cloud adoption in big companies still has a ways to go, but even in these early days, the emerging trend line is becoming increasingly clear. Nick Carr even called this one in the "Big Switch", in the form of this excerpt from pg. 118...

"...larger companies...can be expected to pursue a hybrid approach for many years, supplying some hardware and software requirements themselves and purchasing others over the grid. One of the key challenges for corporate IT departments, in fact, lies in making the right decisions about what to hold on to and what to let go."

The idea that app portfolios will be partitioned in this way seems pretty intuitive to the folks that are grappling with the change, at least based on the customer discussions we're having these days. To be clear ... the cloud design point is, without a doubt, what we're headed toward with a new generation of apps that are going live in increasing numbers every day (and the subject of a future post), but their place in the broader business app portfolio makes it's trajectory more akin to a dimmer that's turned up over time than a simple on/off.

Thanks for listening – comments & feedback welcome.

-Tim

Date Published: Feb 15, 2012 - 1:18 pm


Hot Apps: BulletAsylum, Fragger, Purity, Skee Ball 7, Covers


Hot Apps will feature 5 of the hottest apps each week for the Windows Phone 7. In this episode Laura takes a look at:

Please leave suggestions for hot apps that should be featured in the comments section, thanks!

Date Published: Feb 15, 2012 - 1:17 pm


Ping 131: Kinect Star Wars, Microsoft in Austin, OneNote for Droids, Kinect helps people see


Paul is off doing something, somewhere so Clint Rutkas ever so graciously agreed to fill the big shoes and co-host Ping. Here's what Clint talks about (Laura too):

Another Microsoft Store?  [07:28]

Kinect Star Wars!  [02:38]

OneNote for Android   [05:42]

Kinect helps the visually impaired  [10:20]

 

 

Date Published: Feb 14, 2012 - 11:18 am


A Concept Design for C++


C++ does not provide facilities for directly expressing what a function template requires of its set of parameters. This is a problem that manifests itself as poor error messages, obscure bugs, lack of proper overloading, poor specification of interfaces, and maintenance problems.

Many have tried to remedy this (in many languages) by adding sets of requirements, commonly known as "concepts." Many of these efforts, notably the C++0x concept design, have run into trouble by focusing on the design of language features.

This talk presents the results of an effort to first focus on the design of concepts and their use; Only secondarily, we look at the design of language features to support the resulting concepts. We describe the problem, our approach to a solution, give examples of concepts for the STL algorithms and containers, and finally show an initial design of language features. We also show how we use a library implementation to test our design.

So far, this effort has involved more than a dozen people, including the father of the STL, Alex Stepanov, but we still consider it research in progress rather than a final design. This design has far fewer concepts than the C++0x design and far simpler language support. The design is mathematically well founded and contains extensive semantic specifications (axioms).

Date Published: Jan 15, 2012 - 12:34 pm


Audio Fundamentals


In the final installment of the Kinect for Windows Quickstart series, we’ll discuss how you can leverage the audio features of Kinect in your application, including:

  • How to use your Kinect to determine the angle and confidence for where a sound is coming from
  • How to use the KinectAudioSource to record audio synchronously and asynchronously
  • How to build a basic speech recognition application to dynamically turn application features on/off
  • How the speech recognition engine can be used even when the application is not the current active application 

Resources

Date Published: Feb 01, 2012 - 6:48 am


Static If I Had a Hammer


All right, the C++11 Standard is done. Can we go home? Definitely not - progress waits for no one.

For all its might, C++11 is not addressing a few basic needs in template programming. For example, you'd hate to have to define a new function or indeed a whole new class wherever you need an "if" statement; yet, this is exactly what we do for template code. Also, conditional overloading using the likes of std::enable_if is syntactically bulky and semantically ham-fisted (as is visible with constructors and other special functions).

This talk describes a new proposal (joint work with Herb Sutter and Walter Bright): a "static if" construct that works much like "if", just during compilation. It's reminiscent of #if, just done copiously right.

With "static if" a lot of generic code becomes radically simpler, which in turn enables idioms that today are too complex to be usable. This proposal for C++ benefits from a large body of experience within the D programming language.

Date Published: Jan 15, 2012 - 12:34 pm


TWC9: Windows 8, C++ Amp, NuGet, Mouse Mischief and more


This week on Channel 9, Dan and Duncan discuss the week's top developer news, including:

Picks of the Week!

Date Published: Feb 11, 2012 - 12:58 pm


Interactive Panel: The Importance of Being Native


In 2011, we saw a resurgence of interest in native code - in C++ in 2011 and in C++11. Is this "C++ Renaissance" a flash in the pan? Is it a long-term trend?

This is an interactive panel. This means you, the attendee in the room or online, will be first class members of the conversation - you drive it. You ask the questions. The theme has been provided. Where do you want to take it? It's up to you.

Date Published: Jan 11, 2012 - 7:22 pm


Episode 70 - Windows Azure Demos with Steve Marx


Join Wade and Steve each week as they cover the Windows Azure platform. You can follow and interact with the show at @CloudCoverShow.

In this episode, we are very sad to bid Steve Marx farewell as he looks for new challenges outside of Microsoft. Fortunately, we're able to share some of his best moments on the Cloud Cover show and review some of the best demos he's built over the years.

In the news:

You can stay in touch with Steve Marx through his blog at http://blog.smarx.com/.

Date Published: Feb 10, 2012 - 9:45 am


Skeletal Tracking Fundamentals


In the skeletal tracking Quickstart series video, we'll discuss:

  • How skeleton data retrieves joint information for 20 joints (head, hands, hip center, etc)
  • How skeletal tracking works and how you can choose what skeletons to track using tracking IDs.
  • How you can tweak TransformSmoothParameters based on your applications needs (responsiveness versus smoothness)
  • How you can use the built-in depth mapping methods to map a skeletal joint’s position into depth and color space
  • How you can use the Coding4Fun Toolkit to scale the skeletal joint value to make it easier for users of your application to not have to extend their reach when using your hand as a cursor
  • How to use the SkeletonViewer to visualize all joints returned by Kinect including whether those joints are not tracked.

Resources

Date Published: Feb 01, 2012 - 6:46 am


Let your apps sell themselves!


Don't miss any opportunity to market your Windows Phone apps!  Each one of your apps can serve as an ad for your other apps.    Learn how to add a listing of everything you have published in Marketplace to each of your apps.  Even better, it will always be up to date!

Introduction

imageI've written a number of Windows Phone apps, and each time I've wanted to let people know about my other apps.  While I could mention the other apps somewhere, I wouldn't want to update all of my apps each time I release a new one.  It finally occurred to me that I could use the listing of apps directly from Marketplace instead.  This provides me with an easy-to-parse XML feed (Atom) of my apps with all of the info that I need.  Armed with that, it wasn't too much work to create a user control to let me drop in the list of apps anytime I need it.

This code doesn't require a physical phone, but it isn't very useful if you don't have a Marketplace account!  Ideally, you should have several published apps under your account for this to make much sense.  Once you have it in place though, all of your apps will always show your complete list without any special updates.

If you don't have the software installed, go to create.msdn.com, then click Download the free tools to download the Windows Phone Developer Tools (or use the direct download link provided above this Introduction section). This code is written for the Windows Phone Developer Tools 7.1 (Mango).  It’s is a mostly online install, and it’s pretty big so expect it to take some time. Even if you don’t have any development tools, this will give you Visual Studio Express, Blend, and XNA Game Studio. If you have the full-version tools already, it will add new templates.

Project Basics

The intention is to create a user control to display a list of apps from a given publisher (preferably yourself!).  This user control will be implemented as a ListBox with individual apps showing up visually similar to the way they do in Marketplace.  Touching an app in the list should bring the user directly to the appropriate Marketplace page.  It should be as easy as adding a project reference, adding the control to a XAML page, and setting the publisher (this could potentially be set by reading the WMAppManifest.xml file).

MyAppsList

Marketplace Data

At first glance, getting Marketplace data programmatically isn't an option.  Sadly, there's no API for this.  Fortunately, there's a solution!  If you're using the Zune app to browse publishers and apps, you can watch the network traffic using Fiddler (http://fiddler2.com/fiddler2/).  What's nice is that everything you do in Zune results in a simple HTTP request for the data, which is returned as an XML stream.  A simple WebRequest object can do a DownloadStringAsync call to get the data, then the SyndicationFeed class can load and parse it.  There are extension elements for rating, release date, and price.  Even nicer, is that the image thumbnail can be resized server-side based on the URL query string.  This makes it super easy to get exactly what we need.

The server of interest is catalog.zune.net, and the URL format is:

 


/v3.2/en-US/apps?q=PublisherName&clientType=WinMobile 7.1&store=zest

The "q" parameter just needs to be set to the publisher name of interest.  Remember to URL encode yours if you have spaces in it.

Note the "clientType" parameter.  If you change it to WinMobile 7.0 you will get NoDo (pre-Mango) apps only.  You may or may not have anything show up for that, but it's not likely you'll want that list.

The "store" parameter is set to "zest" but we'll just have to take this one on faith!  I'm not aware of any other options here.  This could vary by country, but I don't have any data on that.

This will return all apps for Mango.  This returns feed information starting with a header:

 




  
  1
  5
  5
  2012-01-30T04:21:41.9702941Z
  List Of Items
  tag:catalog.zune.net,2012-01-30:/apps

 

You can pretty much ignore this section.  The important stuff comes next!  Each Atom entry is one app, along with every bit of metadata that you need to make an interesting view:

 

  

    2012-01-30T04:21:41.9858942Z
    Metro Lockscreen Creator
    urn:uuid:0f5eaaa8-e75e-4a04-a5f9-24db1c176a6b
    Metro Lockscreen Creator
    2011-07-26T14:30:39.987Z
    1.3.0.0
    7.254902
    51
    5.2
    5
    
      urn:uuid:cb46389d-6d50-4be0-b4ff-75c968f301ea
    
    
      
        windowsphone.toolsandproductivity
        
tools + productivity

        True
      
    
    
      apptag.independent
    
    
      
        urn:uuid:b8d5cc60-0839-4bcb-b26e-e85ba3e92c8d
        urn:uuid:2ff871ea-cf8a-488e-b613-286052b90a13
        
          WinMobile 7.1
        
        
          Credit Card
          Mobile Operator
        
        Zest
        0
        $0.00
        USD
        Purchase
      
    
    
      Arian T. Kulp
      Arian T. Kulp
    
  

From this block you can get title, release date, rating average and count, category, image ID (easily converted to URL), and price (per market).  The System.ServiceModel.Syndication.SyndicationFeed class can read from an XMLReader object and it handles everything for you.  Dealing with the custom Marketplace namespace can lead to some slight complication, but fortunately that's simplified as well.

Syndicated Data

For standard Atom elements (the ones with the a: namespace here), you can use properties of the SyndicationItem class.  For some reason, the SyndicationItem class isn't actually available in the Windows Phone libraries.  I'm not sure why this is the case, but it turns out that you can use the desktop version without a problem.  Just add a reference to the "C:Program Files (x86)Microsoft SDKsSilverlightv3.0LibrariesClientSystem.ServiceModel.Syndication" assembly.  You might get a warning when you add it, but it will work fine.  If you download the accompanying code, you'll get all the assemblies you need in it.

The SyndicationItem class gets you properties like Title and Id.  The other properties are all custom types in the "http://schemas.zune.net/catalog/apps/2008/02" namespace.  From these properties, you are interested in shortDescription, userRatingCount, averageUserRating, version, releaseDate, displayPrice, and priceCurrencyCode.  Instead of worrying about namespaces, since you know they are custom elements, you can use the ElementExtensions collection on the SyndicationItem and query the OuterName property.  A simple extension method makes this easy:

Visual Basic

 


Private Shared Function GetExtensionElementValue(Of T)(item As SyndicationItem, extensionElementName As String) As T
  Dim f = (From ee In item.ElementExtensions Where ee.OuterName = extensionElementName).FirstOrDefault()

  Return If(f Is Nothing, Nothing, f.GetObject(Of T)())
End Function

Visual C#


private static T GetExtensionElementValue(SyndicationItem item, string extensionElementName)
{
    var f = item.ElementExtensions.Where(ee => ee.OuterName == extensionElementName).FirstOrDefault();
    return f == null ? default(T) : f.GetObject();
}

With this method in place, you can create most of a new MarketplaceApp object with the following code:

Visual Basic

 


Dim app = New MarketplaceApp() With { _
    .Id = id, _
    .AppLink = "http://windowsphone.com/s?appid=" & Convert.ToString(id), _
    .Title = item.Title.Text, _
    .ShortDescription = GetExtensionElementValue(Of String)(item, "shortDescription"), _
    .UserRatingCount = GetExtensionElementValue(Of Integer)(item, "userRatingCount"), _
    .Version = GetExtensionElementValue(Of String)(item, "version"), _
    .AverageUserRating = GetExtensionElementValue(Of Double)(item, "averageUserRating") / 2.0, _
    .ReleaseDate = GetExtensionElementValue(Of String)(item, "releaseDate"), _
    .PrimaryImageUrl = Root & "/v3.2/en-US/apps/" & Convert.ToString(id) & "/primaryImage?width=95&height=95&resize=true", _
    .DisplayPrice = "Unknown" _
}

Visual C#


var app = new MarketplaceApp
{
    Id = id,
    AppLink = "http://windowsphone.com/s?appid=" + id,
    Title = item.Title.Text,
    ShortDescription = GetExtensionElementValue(item, "shortDescription"),
    UserRatingCount = GetExtensionElementValue(item, "userRatingCount"),
    Version = GetExtensionElementValue(item, "version"),
    AverageUserRating = GetExtensionElementValue(item, "averageUserRating") / 2.0,
    ReleaseDate = GetExtensionElementValue(item, "releaseDate"),
    PrimaryImageUrl = Root + "/v3.2/en-US/apps/" + id + "/primaryImage?width=95&height=95&resize=true"
};

Where it gets a little bit tricky is the "offers" block.  This is an XML block within the overall Item block.  This requires that you shift over to an XmlReader method of parsing.  This works by reading the XML sequentially, stopping at elements of interest.  You start by finding the "offers" element, but instead of using the GetObject method, you use GetReader.  From there, you use a while loop to visit every node, and grab the value if it's of XmlNodeType.Element and either displayPrice or priceCurrencyCode.

Visual Basic

 


Dim offers = (From ee In item.ElementExtensions Where ee.OuterName = "offers").FirstOrDefault().GetReader()

' TODO: Restrict to current country's offer
If offers.ReadToFollowing("offer") Then
    While offers.Read()
        If offers.NodeType = XmlNodeType.Element Then
            If offers.Name = "displayPrice" Then
                app.DisplayPrice = offers.ReadElementContentAsString()
            ElseIf offers.Name = "priceCurrencyCode" Then
                app.PriceCurrencyCode = offers.ReadElementContentAsString()
            End If
        End If
    End While
End If

Visual C#


var offers = item.ElementExtensions.
    Where(ee => ee.OuterName == "offers").FirstOrDefault().GetReader();

// TODO: Restrict to current country's offer
if (offers.ReadToFollowing("offer"))
{
    while(offers.Read())
    {
        if (offers.NodeType == XmlNodeType.Element)
        {
            if (offers.Name == "displayPrice")
                app.DisplayPrice = offers.ReadElementContentAsString();
            else if (offers.Name == "priceCurrencyCode")
                app.PriceCurrencyCode = offers.ReadElementContentAsString();
        }
    }
}

Notice the "TODO" block.  If you are offering your app for sale at different prices in different markets, this will only grab the first offer.  Ideally, this should grab the offer for the user's location, but that's another topic!

Creating the Control

Creating a user control makes it easy to add your list of apps anywhere.  I like to add it to a PivotItem in my About page.  There are really three things to do:

 

  1. Download the XML
  2. Parse the XML into model objects
  3. Bind the collection of items to a list

Of course, before you can show anything, you'll want to create a template to serve as the ItemTemplate in the control.  This will use databinding to point back at the properties of the marketplace entries to display the name, price, image, etc.  This can be created inline within the ListBox markup, or in the UserControl.Resources block (as it is in this case).  The root element is a Grid.  The Image shows the app's icon, and the StackPanel displays the title, price, and rating information.



    
        
            
            
        

        
        
            
            
            
        
    

With the template complete, you just need a ListBox with the ItemTemplate set to the above template. 



    
    
        
        
    
    
        
    

The other elements are used to display a loading message and an error message.  Switching between the list, loading, or error message is accomplished using VisualStateManager with the "Normal," "Loading," or "Error" states accordingly.

The only other methods needed in the code-behind are to handle selection and caching.  When an item is selected, you create a MarketplaceDetailTask object, set the ContentIdentifier to the app's unique ID, and call Show().  Set the SelectedIndex property back to -1 to prevent a problem where a user can't press the same item twice in the row.

The caching is important so the app doesn't cause data access on every single visit to the control.  It's currently set to reload once per day, but this could be changed (or better yet, made configurable).  Even if it's more than a day, if there's an error downloading the data it will always fallback to cache.

Visual Basic

 


Dim items As IEnumerable(Of MarketplaceApp) = Nothing

If IsolatedStorageSettings.ApplicationSettings.Contains("PublisherAppsControls.Items") Then
  items = DirectCast(IsolatedStorageSettings.ApplicationSettings( _
    "PublisherAppsControls.Items"), IEnumerable(Of MarketplaceApp)) 
  ' Use the cache if within a day...
  Dim dt = CType(IsolatedStorageSettings.ApplicationSettings( _ 
    "PublisherAppsControls.Items.DateTime"), DateTime)

  If DateTime.Now.Subtract(dt).TotalDays < 1 Then
    ctrl.Apps.Clear()
    For Each i In items
      ctrl.Apps.Add(i)
    Next
    Return
  End If
End If

Visual C#


IEnumerable items = null;

if (IsolatedStorageSettings.ApplicationSettings.Contains("PublisherAppsControls.Items"))
{
    items = (IEnumerable)
             IsolatedStorageSettings.ApplicationSettings["PublisherAppsControls.Items"];
    // Use the cache if within a day...
    var dt = (DateTime)IsolatedStorageSettings.
               ApplicationSettings["PublisherAppsControls.Items.DateTime"];
    if (DateTime.Now.Subtract(dt).TotalDays < 1)
    {
        ctrl.Apps.Clear();
        foreach (var i in items) ctrl.Apps.Add(i);
        return;
    }
}

Next Steps

I haven't tested this app against publishers with large numbers of apps.  I'm not sure if they would all come back in the response or if there would be more requests to make.  It would also be good to filter out the currently running app.  This could be obtained from the WMAppManifest.xml file.  As mentioned in the article, it would also be good to restrict the offer to the current country, but I really don't know how to do that without using the location API, which seems too heavy-handed.

It would be nice to create a general-purpose library for Zune Marketplace data.  There are some good starts out there from the likes of Brandon Watson and Jesse Liberty, a CodePlex library, and even another Coding4Fun project, but much of that is based on general catalog data, or specialized for music entries.  Even better would be if Microsoft can put out their own API!  That would ensure a better experience if/when formats change over time.

Conclusion

XML has made the world of data so much easier to consume!  As soon as I saw structured data as the foundation for Zune I knew this would be a pretty easy project.  Being able to advertise all of your apps in each of your apps provides a great way to promote with a minimum of effort.

About the Author

Arian Kulp is a software developer living in Western Oregon. He creates samples, screencasts, demos, labs, and articles, speaks at programming events, and enjoys hiking and other outdoor adventures with his family.

Date Published: Feb 13, 2012 - 3:05 pm


Day 2 Keynote - Herb Sutter: C++11, VC++11 and Beyond


This talk will cover:
  • Which key features in C++11 will most change the way you write code: the features that directly affect C++ style, coding idioms, and the guidance in pre-C++11 books and articles that most needs to be updated.
  • Specific guidance on each of those key features: how each one changes your code; tips on using it well; and a pitfall or two to avoid (and how).
  • Status update on C++11 adoption: how compilers, books, and programmers are doing, plus a few updates and projections.
  • What's next for C++: what's top of mind for the near future of Standard C++, and why?
Date Published: Jan 28, 2012 - 5:31 pm


 
Visitor Rating: 7.7 (13) (Rate)

Story Clicks: 3

Feed Views: 285

Lenses (Add|?)

Comments (Log in to add)

Feed Details
Date Added: 11/06/2009
Date Approved: 11/06/2009
By: Anonymous
Search FeedAgg.com




3600 mp9893 serv 2.9304 seconds to generate.