How to use ShareLinkTask namespace in Windows Phone 8.1?

后端 未结 1 918
轮回少年
轮回少年 2021-01-03 11:42

I am developing an app and i am trying to share my app, in Windows Phone 8 Siverlight and Windows Phone 8.1 Silverlight, i used these codes:

ShareLinkTask sh         


        
1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-03 12:43

    In Windows Phone 8.1, You can share link using DataTransferManager(namespace:Windows.ApplicationModel.DataTransfer).

    Here is code:

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        DataTransferManager dtManager = DataTransferManager.GetForCurrentView();
        dtManager.DataRequested += dtManager_DataRequested;
    }
    
    private async void dtManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
    {
        e.Request.Data.Properties.Title = "Code Samples";
        e.Request.Data.Properties.Description = "Here are some great code samples for Windows Phone.";
        e.Request.Data.SetWebLink(new Uri("http://code.msdn.com/wpapps"));
    }
    // Click Button to share Web Link
    private void btnShareLink_Click(object sender, RoutedEventArgs e)
    {
        Windows.ApplicationModel.DataTransfer.DataTransferManager.ShowShareUI();
    }
    

    0 讨论(0)
提交回复
热议问题