Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

WinRT library for structured data sharing using Schema.org data formats

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 build
Octocat-spinner-32 src
Octocat-spinner-32 tools
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE.md
Octocat-spinner-32 README.md
README.md

Transhipment

WinRT library for structured data sharing (via Share Contract) using Schema.org data formats.

How To Install

NuGet

PM> Install-Package Transhipment

Usage

Share data - JavaScript

function dataRequested(e) {
    var request = e.request;

    var geo = Transhipment.SchemaFactory.create(Transhipment.Schema.geoCoordinates);
    geo.name = "Polar Bear Provincial Park";
    geo.latitude = "54.596931";
    geo.longitude = "-83.283978";

    request.data.properties.title = "Sample data";
    request.data.properties.description = "data for " + geo.type;

    Transhipment.SchemaFactory.setStructuredData(request.data, geo);
}

Share data - C#

void DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
    var request = args.Request;

    var geo = SchemaFactory.Create(Schema.GeoCoordinates) as IGeoCoordinates;
    geo.Name = "Polar Bear Provincial Park";
    geo.Latitude = "54.596931";
    geo.Longitude = "-83.283978";

    request.Data.Properties.Title = "Sample data";
    request.Data.Properties.Description = "data for " + geo.Type;
    request.Data.SetStructuredData(geo);
}

Retrive shared data (share target) - C#

public async void Activate(ShareTargetActivatedEventArgs args)
{
    shareOperation = args.ShareOperation;
    var geo = await shareOperation.Data.GetStructuredDataAsync(Schema.GeoCoordinates) as IGeoCoordinates;
    if (geo != null)
    {
        DefaultViewModel["ThingName"] = geo.Name;
        DefaultViewModel["Latitude"] = geo.Latitude;
        DefaultViewModel["Longitude"] = geo.Longitude;
    }

    // ...
}
Something went wrong with that request. Please try again.