Skip to main content
All CollectionsDeveloper
Windows Phone Community Development Kit (SDK)
Windows Phone Community Development Kit (SDK)
Disqus avatar
Written by Disqus
Updated over a week ago

The Disqus Launcher SDK for Windows Phone 8.1 allows you to request details for discussions and launch the Disqus app to a particular discussion.

Prerequisites

  • A Windows Phone app that targets Windows Phone 8.1 Runtime or Silverlight. There is no support for Windows Phone 8.0 apps at this time.

  • If you're using the API client, you must have registered a API application. Make sure you set at least one trusted domain so you can pass that and the public key into the app's API client.

  • An existing site that uses Disqus with a strong disqus_identifier or disqus_url pattern.

Installation

You can install the SDK via NuGet:

PM> Install-Package Disqus.SDK.Windows

Dependencies

  • Newtonsoft.Json (≥ 6.0.8)

  • Microsoft.Bcl (≥ 1.1.9)

  • Microsoft.Bcl.Build (≥ 1.0.21)

  • Microsoft.Net.Http (≥ 2.2.28)

Requesting Discussion Details

The SDK provides methods to access the API using the threads/set endpoint using a variety of arguments. This will allow you to retrieve things like a recent comments feed, the number of comments on a discussion and more.

Start the client

To get started, first create the DisqusClient instance:

Disqus.SDK.DisqusClient.Create("YOUR_PUBLIC_KEY", new Uri("http://yourdomain.com/"));

Make sure you place this somewhere before you start making requests or else you may end up getting a NullReferenceException.

Make requests

You can request thread details using either URLs, custom Disqus identifiers, unique Disqus IDs or even with WordPress post IDs, if you're using the Disqus plugin for WordPress.

The example below assumes you have a class that has your website's posts/articles stored in a List called "SitePosts", of which there's a property called "CommentCount".

string shortname = "YOUR_SITE_SHORTNAME";
List disqusIdentifiers = new List
{
	"custom_identifier_1",
	"custom_identifier_2"
};// A Dictionary will be returned using your custom identifier as the key
var response = await Disqus.SDK.DisqusClient.Instance.GetDiscussionDetailsAsync(disqusIdentifiers, shortname);foreach (var p in this.SitePosts)
{
	if (response.ContainsKey(p.CustomIdentifier))
		p.CommentCount = response[p.CustomIdentifier].CommentCount;
}

Launching the Disqus app

While this SDK won't provide any ways for a user to engage with the comment, you can use one of the variety of launchers to open the Disqus app to a discussion you specify.

As with loading a discussion from the API, you can use a variety of arguments to launch a discussion. Building off of the example above, if you had a button on your page that said "View in Disqus", this is what the Click event handler might look like.

private async void openInDisqusButton_Click(object sender, RoutedEventArgs e)
{
	if (this.ViewModel.CanLaunchDisqus)
		await Disqus.SDK.Launchers.LaunchDiscussionAsync(this.ViewModel.CustomIdentifier, this.ViewModel.DisqusShortname);
}

Example apps

You can find apps that use the SDK below.

Did this answer your question?