Sharing from Windows Phone 8

前端 未结 4 1862
无人及你
无人及你 2020-12-01 15:20

I am working on a Windows Phone 8 app and am trying to share content through the DataTransferManager. The Windows API documentation says it is supported in

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-01 15:44

    I think I have found most of what I was looking for with Launchers... Rather than just using the Windows 8 general sharing functionality I can be specific with Tasks/Launchers.

    Unfortunately it doesn't have as many sharing options as the charm does, I will be implementing several functions for email/sms/social but so far this is the best solution.

    Here are the functions that I will be implementing

        private void ShareLink(object sender, System.Windows.Input.GestureEventArgs e)
        {
            ShareLinkTask shareLinkTask = new ShareLinkTask()
                {
                    Title = "Code Samples",
                    LinkUri = new Uri("http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff431744(v=vs.92).aspx", UriKind.Absolute),
                    Message = "Here are some great code samples for Windows Phone."
                };
    
            shareLinkTask.Show();
        }
    
    
        private void ShareEmail(object sender, System.Windows.Input.GestureEventArgs e)
        {
            EmailComposeTask emailComposeTask = new EmailComposeTask()
                {
                    Subject = "message subject",
                    Body = "message body",
                    To = "recipient@example.com",
                    Cc = "cc@example.com",
                    Bcc = "bcc@example.com"
                };
    
            emailComposeTask.Show();
        }
    
        private void ShareSMS(object sender, System.Windows.Input.GestureEventArgs e)
        {
            SmsComposeTask smsComposeTask = new SmsComposeTask()
                {
                    Body = "Try this new application. It's great!"
                };
    
            smsComposeTask.Show();
        }
    

    Ref:

    Launchers for Windows Phone

    Share Link Task

提交回复
热议问题