0

I have faced a problem, that Sharing in windows 8 is very buggy. Because i downloaded a sample from MSDN "Sharing content source app sample" and it worked fine few times (lets say 3). On a 4 time when i ran the sample it shows:

Can't share at the moment ( internet is up and mail accounts are connected )

On 5 time it generated the mail content but couldn't send, and so on.

So in my own application, i have seen the same picture. Can anybody tell what is the problem?

Specially for this, i have created a small app:

public sealed partial class MainPage : Page
{
    DataTransferManager dtm;
    public MainPage()
    {
        this.InitializeComponent();
    }
    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        dtm = DataTransferManager.GetForCurrentView();
        dtm.DataRequested += OnDataRequested;
    }
    protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
    {
        dtm.DataRequested -= OnDataRequested;
        base.OnNavigatingFrom(e);
    }
    private async void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs e)
    {
        DataRequestDeferral deferral = e.Request.GetDeferral();
            var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(@"shareappemail.html");
            var stream = await file.OpenReadAsync();
            var rdr = new StreamReader(stream.AsStream());
            var contents = await rdr.ReadToEndAsync();
            DataPackage requestData = e.Request.Data;
            requestData.Properties.Title = "MyAppTitle";
            requestData.Properties.Description = "ShareWithSomebody"; // The description is optional.
            requestData.SetHtmlFormat(HtmlFormatHelper.CreateHtmlFormat(contents));
        deferral.Complete();
    }
}

shareappemail.html - is just some html template of an email.

And this code doesn't work... Can somebody tell what is wrong? ( Even Microsoft Photo app isn't sharing... )

enter image description here

AnFi
  • 10,493
  • 3
  • 23
  • 47
Developer
  • 4,158
  • 5
  • 34
  • 66
  • I don't know if this will help, but all I can say is that I have seen many problems in Windows 8, and seen them all disappear in 8.1. – Kris Vandermotten Nov 06 '13 at 08:40
  • One more thing: in my experience with Windows 8, as soon as a share attempt went bad, I had to reboot the machine or all subsequent share attempts would go bad. Maybe log-off-log-on is enough, but I used to reboot. It took a looooooong time debugging that sharing code. – Kris Vandermotten Nov 06 '13 at 08:43
  • Oh, something reminds me of Vista vs Windows 7... – Developer Nov 06 '13 at 08:43
  • I was talking about problems with the sharing contract, as described by OP. – Kris Vandermotten Nov 06 '13 at 08:45

0 Answers0