当前位置: 首页>>代码示例>>C#>>正文


C# ISession.GetTopicControlFeature方法代码示例

本文整理汇总了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 ) );
        }
开发者ID:pushtechnology,项目名称:diffusion-examples,代码行数:36,代码来源:ControlClentUpdatingRecordTopics.cs

示例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() );
        }
开发者ID:pushtechnology,项目名称:diffusion-examples,代码行数:33,代码来源:ControlClientUpdatingPagedTopics.cs

示例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();
        }
开发者ID:pushtechnology,项目名称:diffusion-examples,代码行数:14,代码来源:ControlClientAsUpdateSource.cs

示例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 ) );
        }
开发者ID:pushtechnology,项目名称:diffusion-examples,代码行数:14,代码来源:ControlClientUpdatingJSONTopics.cs

示例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() );
        }
开发者ID:pushtechnology,项目名称:diffusion-examples,代码行数:14,代码来源:ControlClientUpdatingTopic.cs

示例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);
        }
开发者ID:pushtechnology,项目名称:blog-steering-wheel,代码行数:19,代码来源:TopicManager.cs

示例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 ) );
 }
开发者ID:pushtechnology,项目名称:diffusion-examples,代码行数:9,代码来源:ControlClientConnectingAsynchronously.cs


注:本文中的ISession.GetTopicControlFeature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。