locked
How to close Share flyout programmatically? RRS feed

  • Question

  • Share as target scenario. Some app shares some content with our app. We save it. After giving the user a feedback that the action was successfully completed, how do we programmatically close the flyout?

    We create delicious software

    Wednesday, October 24, 2012 12:19 AM

Answers

  • If your application is the share target, then once the share operation is completed, you have to ReportCompleted... this will dismiss the sharing window... here you can find an example... it is in javascript but the idea is the same...

    if (eventArgs.kind === Windows.ApplicationModel.Activation.ActivationKind.shareTarget) {
        shareOperation = eventArgs.shareOperation;
        if (shareOperation.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.text)) {
            var output = document.createElement("div");
            var shareData = shareOperation.data.getText();
            output.innerText = shareData;
            document.body.appendChild(output);
            shareOperation.reportCompleted();
        }
    }


    Can Bilgin
    Blog CompuSight

    • Marked as answer by VerySoftware Wednesday, October 24, 2012 6:00 PM
    Wednesday, October 24, 2012 6:16 AM

All replies

  • You can't. You can only report back completion of share.
    Wednesday, October 24, 2012 3:11 AM
  • If your application is the share target, then once the share operation is completed, you have to ReportCompleted... this will dismiss the sharing window... here you can find an example... it is in javascript but the idea is the same...

    if (eventArgs.kind === Windows.ApplicationModel.Activation.ActivationKind.shareTarget) {
        shareOperation = eventArgs.shareOperation;
        if (shareOperation.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.text)) {
            var output = document.createElement("div");
            var shareData = shareOperation.data.getText();
            output.innerText = shareData;
            document.body.appendChild(output);
            shareOperation.reportCompleted();
        }
    }


    Can Bilgin
    Blog CompuSight

    • Marked as answer by VerySoftware Wednesday, October 24, 2012 6:00 PM
    Wednesday, October 24, 2012 6:16 AM
  • Many thanks, Can! shareOperation.reportCompleted() helped.

    We create delicious software http://verysoftware.com

    Wednesday, October 24, 2012 6:00 PM