locked
How to generate share content asynchronously when user clicks on Share Charm RRS feed

  • Question

  • How can I generate share content asynchronously when the user clicks on the share charm.

    The content I need to generate might take several seconds to generate.  Because of this, the share pane is showing "There's no content to share"

    Thanks in advance.

    Friday, March 22, 2013 8:39 PM

Answers

  • this way:

    async void DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
            {
                var d = args.Request.GetDeferral();
    
                // do your async stuff
    
                d.Complete();
            }

    but still think this is not allowing to take seconds and then you need to do it on a more complicated way with:

    async void DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
            {
                var d = args.Request.GetDeferral();
    
    
                args.Request.Data.SetDataProvider(Windows.ApplicationModel.DataTransfer.StandardDataFormats.Text, GetText);
    
                d.Complete();
            }
    
            private void GetText(DataProviderRequest request)
            {
    
            }


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Friday, March 22, 2013 9:36 PM

All replies

  • this way:

    async void DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
            {
                var d = args.Request.GetDeferral();
    
                // do your async stuff
    
                d.Complete();
            }

    but still think this is not allowing to take seconds and then you need to do it on a more complicated way with:

    async void DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
            {
                var d = args.Request.GetDeferral();
    
    
                args.Request.Data.SetDataProvider(Windows.ApplicationModel.DataTransfer.StandardDataFormats.Text, GetText);
    
                d.Complete();
            }
    
            private void GetText(DataProviderRequest request)
            {
    
            }


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Friday, March 22, 2013 9:36 PM
  • args.Request.Data.SetDataProvider(Windows.ApplicationModel.DataTransfer.StandardDataFormats.Text, GetText);

    if the format is

    StandardDataFormats.

    StorageItems

    how to do it?

     

     

     

     


    自强不息,知行合一。

    Friday, August 2, 2013 6:47 AM