Hi,
I'm prototyping an application for my company and have hit a snag regarding the Share contract. If I launch my app then switch over to the Photos app to share a picture to it, my Share contract target page will launch then close nearly immediately.
However, if I close my app then attempt to share a picture from the Photos app, everything seems to be just fine.
** I should note that my other contracts behave normally **
My App.xaml.cs file for OnShareTargetActivated looks like this:
var shareTargetPage = new ShareTargetPage1();
shareTargetPage.Activate(args);
In ShareTargetPage1:
public async void Activate(ShareTargetActivatedEventArgs args)
{
this._shareOperation = args.ShareOperation;
// Communicate metadata about the shared content through the view model
var shareProperties = this._shareOperation.Data.Properties;
var thumbnailImage = new BitmapImage();
this.DefaultViewModel["Title"] = shareProperties.Title;
this.DefaultViewModel["Description"] = shareProperties.Description;
this.DefaultViewModel["Image"] = thumbnailImage;
this.DefaultViewModel["Sharing"] = false;
this.DefaultViewModel["ShowImage"] = false;
Window.Current.Content = this;
Window.Current.Activate();
// Update the shared content's thumbnail image in the background
if (shareProperties.Thumbnail != null)
{
var stream = await shareProperties.Thumbnail.OpenReadAsync();
thumbnailImage.SetSource(stream);
this.DefaultViewModel["ShowImage"] = true;
}
}
If I remove
Window.Current.Content = this;
Window.Current.Activate();
It doesn't die immediately, but just hangs on the splash screen.
I've been unable to find any documentation stating any limits on the target app not allowed to be running for the Share contract to work.
Is this the expected behavior or is there something that I should be doing different?
Thanks,
Robert