StreamLink for Silverlight
Caplin.StreamLink.Subscription.News Namespace
StreamLink for SilverlightCaplin.StreamLink.Subscription.News
Contains interfaces, classes, and enums related to the NewsHeadline SubjectType. Defines the key interfaces concerning the subscription to a NewsHeadline (INewsSubscription, INewsSubscriptionListener, the interface that provides access to the parameters used to request directories, (INewsSubscriptionParameters), and the interface for handling directory events (INewsEvent).
Declaration Syntax
C#Visual BasicVisual C++
namespace Caplin.StreamLink.Subscription.News
Namespace Caplin.StreamLink.Subscription.News
namespace Caplin.StreamLink.Subscription.News
Types
All TypesInterfaces
IconTypeDescription
INewsEvent
Provides information about a new news headline update (SubjectType News).

INewsSubscription
Represents a subscription to a news headline subject

INewsSubscriptionListener
The INewsSubscriptionListener interface allows applications to receive events raised for a news headline subscription.

INewsSubscriptionParameters
Provides access to the parameters used when requesting a news headline object from the Liberator.

Remarks

NewsHeadline subscriptions are created through the IStreamLinkProvider interface using one of the CreateNewsSubscription(INewsSubscriptionListener, String) methods. In all cases, an INewsSubscriptionListener must be passed along with the name of the NewsHeadline subject being subscribed to.

CopyC#
using System;
using System.Collections.Generic;
using System.Text;

using Caplin.StreamLink;
using Caplin.StreamLink.Authentication;
using Caplin.StreamLink.Subscription.News;
using Caplin.StreamLink.Configuration;
using Caplin.StreamLink.Logging;

namespace StreamLinkExamples.News
{

    /// <summary>
    /// Examples of how to create an INewsSubscription using the
    /// IStreamLinkProvider interface.
    /// </summary>
    public class CreateNewsSubscriptionBasic
    {
        /// <summary>
        /// Creates a simple news subscription with no parameters.
        /// </summary>
        public static void CreateNewsSubscriptionBasicExample()
        {
            // Set up StreamLink and login credentials
            IStreamLinkConfiguration config = SimpleConfiguration.CreateType2HttpConnection("localvm", 8080);

            IStreamLink myStreamLink = new StreamLink(config); 
            myStreamLink.CredentialsProvider =
                new PasswordCredentialsProvider("admin", "admin");
            myStreamLink.Logger = new ConsoleLogger();

            // Finally, connect to the Liberator
            myStreamLink.StreamLinkProvider.Connect();

            // Set up listener and created the subscription for /EXAMPLE/NEWS
            INewsSubscriptionListener listener =
                new ExampleNewsSubscriptionListener();
            INewsSubscription subscription =
                myStreamLink.StreamLinkProvider.CreateNewsSubscription(listener, "/EXAMPLE/NEWS");

            // Subscribe the subscription, this will be queued until we
            // login to the Liberator
            subscription.Subscribe();
        }
    }
}

The object implementing INewsSubscriptionListener will then be informed of all subscription status, error, and NewsHeadline events. (Also see ISubscriptionListener.)