In the previous blog post http://blogs.msdn.com/b/going_metro/archive/2012/05/12/integrating-with-windows-8-share-charm-long-running-shares.aspx we have seen how to handle long running shares. I wanted to share one more thing that I have observed. In the previous example, we have used the "SetDataProvider" method to specify the callback method which provides the Bitmap data . What if I have set other type of data like Text or Html which also require some asynchronous processing.

Following is the implementation using the SetDataProvider method.

 

While I was extending my App, I realized that I also need to set the Text data. And my method which returns Text data is also an asynchronous method. I have already used the SetDataProvider method, to set the callback for getting bitmap data. So I was thinking how can I use the SetDataProvider method again to get the text data. Apparently we can use the SetDataProvider method multiple times for different format's. So I modified my code as follows.