本文整理汇总了C#中ISession.GetTopicControlFeature方法的典型用法代码示例。如果您正苦于以下问题:C# ISession.GetTopicControlFeature方法的具体用法?C# ISession.GetTopicControlFeature怎么用?C# ISession.GetTopicControlFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISession
的用法示例。
在下文中一共展示了ISession.GetTopicControlFeature方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ControlClientUpdatingRecordTopics
/// <summary>
/// Constructor.
/// </summary>
/// <param name="serverUrl">The server url, for example "ws://diffusion.example.com:80".</param>
public ControlClientUpdatingRecordTopics( string serverUrl )
{
session = Diffusion.Sessions.Principal( "client" ).Password( "password" ).Open( serverUrl );
topicControl = session.GetTopicControlFeature();
var mf = Diffusion.Metadata;
// Create the record metadata for the rates topic. It has 2 decimal fields which are maintained to 5
// decimal places and allow empty values.
recordMetadata = mf.RecordBuilder( "Rates" )
.Add( mf.DecimalBuilder( "Buy" ).SetScale( 5 ).SetAllowsEmpty( true ).Build() )
.Add( mf.DecimalBuilder( "Sell" ).SetScale( 5 ).SetAllowsEmpty( true ).Build() )
.Build();
// Create the topic details to be used for all rates topics
topicDetails = topicControl.CreateDetailsBuilder<IRecordTopicDetailsBuilder>()
.EmptyFieldValue( Constants.EMPTY_FIELD_STRING )
.Metadata( mf.Content( "CurrencyDetails", recordMetadata ) )
.Build();
// Create a delta builder that can be reused for bid-only changes
deltaRecordBuilder = Diffusion.Content.NewDeltaRecordBuilder( recordMetadata )
.EmptyFieldValue( Constants.EMPTY_FIELD_STRING );
var updateControl = session.GetTopicUpdateControlFeature();
updateFactory = updateControl.UpdateFactory<IContentUpdateFactory>();
// Register as an updater for all topics under the root
updateControl.RegisterUpdateSource( RootTopic, new TopicUpdateSource( topicUpdater ) );
}
示例2: ControlClientUpdatingPagedTopics
/// <summary>
/// Constructor.
/// </summary>
public ControlClientUpdatingPagedTopics()
{
session = Diffusion.Sessions.Principal( "control" ).Password( "password" )
.Open( "ws://diffusion.example.com:80" );
topicControl = session.GetTopicControlFeature();
var updateControl = session.GetTopicUpdateControlFeature();
orderedUpdateFactory = updateControl.UpdateFactory<IPagedRecordOrderedUpdateFactory>();
unorderedUpdateFactory = updateControl.UpdateFactory<IPagedStringUnorderedUpdateFactory>();
var metadata = Diffusion.Metadata;
// Create an unordered paged string topic
topicControl.AddTopic( UnorderedTopic, topicControl.NewDetails( TopicType.PAGED_STRING ),
new TopicControlAddCallbackDefault() );
// Create an ordered paged record topic
var recordMetadata = metadata.Record( "Record", metadata.String( "Name" ), metadata.String( "Address" ) );
topicControl.AddTopic( OrderedTopic,
topicControl.CreateDetailsBuilder<IPagedRecordTopicDetailsBuilder>()
.Metadata( recordMetadata )
.Order( new PagedRecordOrderKey( "Name" ) )
.Build(),
new TopicControlAddCallbackDefault() );
// Register an updater for topics under the 'Paged' branch
updateControl.RegisterUpdateSource( "Paged", new UpdateSource() );
}
示例3: ControlClientAsUpdateSource
/// <summary>
/// Constructor.
/// </summary>
/// <param name="callback">The callback for updates.</param>
public ControlClientAsUpdateSource( ITopicUpdaterUpdateCallback callback )
{
updateCallback = callback;
session = Diffusion.Sessions.Principal( "control" ).Password( "password" )
.Open( "ws://diffusion.example.com;80" );
topicControl = session.GetTopicControlFeature();
updateControl = session.GetTopicUpdateControlFeature();
}
示例4: ControlClientUpdatingJSONTopics
/// <summary>
/// Constructor.
/// </summary>
/// <param name="serverUrl">for example "ws://diffusion.example.com:80"</param>
public ControlClientUpdatingJSONTopics( string serverUrl )
{
session = Diffusion.Sessions.Principal( "control" ).Password( "password" ).Open( serverUrl );
topicControl = session.GetTopicControlFeature();
// Register as an updater for all topics under the root
session.GetTopicUpdateControlFeature().RegisterUpdateSource( rootTopic,
new MyTopicUpdateSource( valueUpdater ) );
}
示例5: ControlClientUpdatingTopic
/// <summary>
/// Constructor.
/// </summary>
public ControlClientUpdatingTopic()
{
session = Diffusion.Sessions.Principal( "control" ).Password( "password" )
.Open( "ws://diffusion.example.com:80" );
topicControl = session.GetTopicControlFeature();
updateControl = session.GetTopicUpdateControlFeature();
// Create a single-value topic.
topicControl.AddTopicFromValue( Topic, TopicType.SINGLE_VALUE, new TopicControlAddCallbackDefault() );
}
示例6: TopicManager
public TopicManager(ISession session, DataGenerators.ICarControlsDataGenerator carControlsDataGenerator, DataGenerators.ICarStateDataGenerator carStateDataGenerator, RefreshIntervalManager refreshIntervalManager, Metrics metrics)
{
this.carControlsDataGenerator = carControlsDataGenerator;
this.carStateDataGenerator = carStateDataGenerator;
this.refreshIntervalManager = refreshIntervalManager;
this.metrics = metrics;
topics = session.GetTopicsFeature();
topicControl = session.GetTopicControlFeature();
topicUpdateControl = session.GetTopicUpdateControlFeature();
topicPathsPendingAddition = new List<string>();
// The first thing we need to do is kick of an asynchronous request to see
// whether our root topic path already exists.
var topicDetailsHandler = new Handlers.TopicDetailsHandler();
topicDetailsHandler.Success += topicDetailsHandler_Success;
topics.GetTopicDetails(rootTopicPath, TopicDetailsLevel.BASIC, topicDetailsHandler);
}
示例7: OnOpened
/// <summary>
/// Called when a session has been successfully opened.
/// </summary>
/// <param name="session"></param>
public void OnOpened( ISession session )
{
session.GetTopicControlFeature().AddTopic(
topicToAdd, TopicType.SINGLE_VALUE, new TopicAddCallback( session ) );
}