Freigeben über


ShareOperation Class

Behandelt den Großteil der Arbeit während eines Freigabevorgangs. Dies schließt die Daten, die der Benutzer freigeben möchte, sowie das Festlegen oder Entfernen von QuickLinks und das Informieren des Systems über den Status des Vorgangs ein.

Syntax

var shareOperation = promise.operation;
public sealed class ShareOperation
Public NotInheritable Class ShareOperation
public ref class ShareOperation sealed 

Attribute

[MarshalingBehavior(Standard)]

[Version(0x06020000)]

Member

ShareOperationKlasse hat diese Membertypen:

  • Methoden
  • Eigenschaften

Methoden

The ShareOperation Klasse hat diese Methoden. Mit C#, Visual Basic und C++ erbt es auch Methoden aus Object Klasse.

Methode Beschreibung
DismissUI Closes the share pane.
RemoveThisQuickLink Removes the QuickLink from the list of QuickLinks that are available to the user.
ReportCompleted() Specifies that the sharing operation is complete.
ReportCompleted(QuickLink) Specifies that the sharing operation is complete. A QuickLink that the system can save as a shortcut for future sharing operations is included.
ReportDataRetrieved Specifies that the app has acquired the content that the user wants to share.
ReportError Specifies that an error occurred during the sharing operation.
ReportStarted Specifies that the app has started to acquire the content that the user wants to share.
ReportSubmittedBackgroundTask Specifies that the app has requested that the system allow the sharing operation to run as a background task.

 

Eigenschaften

Der ShareOperationKlasse hat diese Eigenschaften.

Eigenschaft Zugriffstyp Beschreibung

Data

Schreibgeschützt Contains a DataPackage object with the data that the user wants to share.

QuickLinkId

Schreibgeschützt A string that contains the ID of a QuickLink.

 

Hinweise

Wenn ein Benutzer Ihre App als Ziel einer Freigabenaktion auswählt, wird ein activated-Ereignis ausgelöst. Das Objekt, das dieses Ereignis zur App sendet, enthält die Instanz der ShareOperation-Klasse.

Hinweis  : Es handelt sich nicht um eine agile Klasse. Daher müssen Sie das Threadingmodell und das Marshallingverhalten berücksichtigen. Weitere Informationen finden Sie unter Threading und Marshalling (C++/CX) und Die Verwendung von Windows-Runtime-Objekten in einer Multithreaded-Umgebung (.NET).

Beispiele

Das folgende Beispiel zeigt die Verwendung des ShareOperation-Objekts.

var shareOperation = eventObject.detail.shareOperation;
if (shareOperation.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.text)) {
    shareOperation.data.getTextAsync().done(function (text) {
            // To output the text using this example, 
            // you need a div tag with an id of "output" in your HTML file.
            document.getElementById("output").innerText = text;
        }, function (e) {
            displayError("Error retrieving Text format: " + e);
        }
    });
}

Anforderungen

Mindestens unterstützter Client

Windows 8 [Nur Windows Store-Apps]

Mindestens unterstützter Server

Windows Server 2012 [Nur Windows Store-Apps]

Namespace

Windows.ApplicationModel.DataTransfer.ShareTarget Windows::ApplicationModel::DataTransfer::ShareTarget [C++]

Metadaten

Windows.winmd

Siehe auch

Quellen-App-Beispiel zum Freigeben von Inhalten

Ziel-App-Beispiel zum Freigeben von Inhalten

Schnellstart: Inhalt freigeben (Windows Store-Apps mit JavaScript und HTML)

Schnellstart: Inhalt freigeben (Windows Store-Apps mit C#, VB, C++ und XAML)

Schnellstart: Freigegebenen Inhalt empfangen (Windows Store-Apps mit JavaScript und HTML)

Schnellstart: Freigegebenen Inhalt empfangen (Windows Store-Apps mit C#, VB, C++ und XAML)