/// <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)); }
public ButtonStatesTopicSource(DataGenerators.ICarControlsDataGenerator carControlsDataGenerator) : base(carControlsDataGenerator) { var contentFactory = Diffusion.Content; recordStructuredBuilder = contentFactory.NewRecordBuilder(recordMetadata); }
public RefreshIntervalTopicSource(RefreshIntervalManager refreshIntervalManager) { this.refreshIntervalManager = refreshIntervalManager; var contentFactory = Diffusion.Content; recordStructuredBuilder = contentFactory.NewRecordBuilder(recordMetadata); }
/// <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 ) ); }