Click or drag to resize

ScoringProgramPipeClient Class

Handles request from the scoring programs. This code is freely available for external programmers to adapt to their specific needs. This code, however, is guaranteed to work. Interop options are available for many programming languages.
Note that this class is written as a singleton: there should never be more than one instance communicating over the pipe. The constructor is protected however, so by inheriting from this class a non singleton instance can be used.
The class implements IDispable through its base class, as the base class contains a stream writer and stream reader that must be disposed when the communication shuts down. Be sure to call Dispose on the class any time it is no longer in use, otherwise communication will stall.
The code has no dependencies, except one on NLog. If you decide to copy the code make sure to add a dependency to the NLog NuGet package or implement your own logging.The logger is defined in the base class and is named "DataConnectorClientLogger".
All public functions have synchronous and asynchronous implementation (ending in "Async").
To get started inspect the following functions:
Connect and ConnectAsync: Connection to the Data Connector.
Initialize and InitializeAsync: Initialization of a new event.
IssueManagementCommand and IssueManagementCommandAsync: Query the Bridgemate Control Software.
Inheritance Hierarchy
SystemObject
  BridgeSystems.Bridgemate.DataConnector.ScoringProgramClientDataConnectorPipeClientScoringProgramDataConnectorCommands
    BridgeSystems.Bridgemate.DataConnector.ScoringProgramClientScoringProgramPipeClient

Namespace: BridgeSystems.Bridgemate.DataConnector.ScoringProgramClient
Assembly: BridgeSystems.Bridgemate.DataConnector.ScoringProgramClient (in BridgeSystems.Bridgemate.DataConnector.ScoringProgramClient.dll) Version: 1.0.923.1+8676f6447fd14feb672ed9c066f2812915b8f069
Syntax
C#
public class ScoringProgramPipeClient : DataConnectorPipeClient<ScoringProgramDataConnectorCommands>

The ScoringProgramPipeClient type exposes the following members.

Constructors
 NameDescription
Protected methodScoringProgramPipeClient Initializes the class.
Top
Properties
 NameDescription
Public propertyStatic memberInstance The single instance of the pipe client. Use this property to retrieve the client and use it in the external program.
Public propertyIsSending Only one request can be sent at the same time. So let asynchronous code always check, set and reset this property before, while and after sending a request. Feel free to make more nifty implementations.
Public propertyLastHandrecordQueueItemId The id of the last handrecord queue item downloaded from the Data Connector. You can use this to internally accept this item (and all before of the same type).
Public propertyLastParticipantQueueItemId The id of the last participant queue item downloaded from the Data Connector. You can use this to internally accept this item (and all before of the same type).
Public propertyLastPlayerDataQueueItemId The id of the last player data queue item downloaded from the Data Connector. You can use this to internally accept this item (and all before of the same type).
Public propertyLastResultQueueItemId The id of the last result queue item downloaded from the Data Connector. You can use this to internally accept this item (and all before of the same type).
Protected propertyLoggingSource The source of the logging records.
(Overrides DataConnectorPipeClientTCommandLoggingSource)
Top
Methods
 NameDescription
Public methodAcceptQueueData Signals to the Data Connector synchronously that a specific type of queuedata up to the specified id does not need to be sent again.
Public methodAcceptQueueDataAsync Signals to the Data Connector asynchronously that a specific type of queuedata up to the specified id does not need to be sent again.
Public methodAddSession Adds the given session to a known event synchronously. This event must have been sent to the Data Connector previously using an InitDTO.
Public methodAddSessionAsync Adds the given session to a known event asynchronously. This event must have been sent to the Data Connector previously using an InitDTO.
Public methodClearData Instructs the DataConnector to synchronously clear all incoming and outgoing queuedata and to remove al validation data as well. Use with caution!
Public methodClearDataAsync Instructs the DataConnector to asynchronously clear all incoming and outgoing queuedata and to remove al validation data as well. Use with caution!
Public methodConnect Connect to the Data Connector synchronously
Public methodConnectAsync Connect to the Data Connector asynchronously.
Public methodContinue Instructs BCS synchronously to continue working with a previously created event.
Public methodContinueAsync Instructs BCS asynchronously to continue working with a previously created event.
Public methodDisconnect Disconnects from the Data Connector synchronously, causing the Data Connector to close the pipe and reopen it.
Public methodDisconnectAsync Disconnects from the Data Connector asynchronously, causing the Data Connector to close the pipe and reopen it.
Protected methodDispose Disposes the class.
(Overrides DataConnectorPipeClientTCommandDispose(Boolean))
Public methodDoesSessionExist Does an synchronous check on if the session with the given guid exists.
Public methodDoesSessionExistAsync Does an asynchronous check on if the session with the given guid exists.
Public methodGetAllMovements Returns the movements synchronously for the given session as they are in use by BCS.Mind that the Data Connector itself creates updates to enact movement changes.
Public methodGetAllMovementsAsync Returns the movements asynchronously for the given session as they are in use by BCS.Mind that the Data Connector itself creates updates to enact movement changes.
Public methodGetMovement Returns the movement for the given section synchronously as it is in use by BCS.Mind that the Data Connector itself creates updates to enact movement changes.
Public methodGetMovementAsync Returns the movement asynchronously for the given section as it is in use by BCS.Mind that the Data Connector itself creates updates to enact movement changes.
Public methodInitialize Instructs BCS to create a new sessions with the provided table domain data (scoring groups, sections, tables, rounds). Player names, Results and Handrecords can be included or can be uploaded later. The latter option is considerably less performant.
Public methodInitializeAsync Instructs BCS to create new sessions with the provided table domain data (scoring groups, sections, tables, rounds). Player names, Results and Handrecords can be included or can be uploaded later. The latter option is considerably less performant.
Public methodIssueManagementCommand Issue a management command to BCS synchronously. This command can either be a query for information on the location of its scoring file, which sessions it is currently administering or which sessions are know to it, or it can be an instruction to shut down.
Public methodIssueManagementCommandAsync Issue a management command to BCS asynchronously. This command can either be a query for information on the location of its scoring file, which sessions it is currently administering or which sessions are known to it, or it can be an instruction to shut down.
Protected methodLogError Logs an exception.
(Overrides DataConnectorPipeClientTCommandLogError(Exception))
Protected methodLogMethodEntry Logs the entry to a method with its parameters (if any).
(Overrides DataConnectorPipeClientTCommandLogMethodEntry(String))
Public methodPing Communicates to the Data Connector synchronously to see if it is responsive. This is done by sending a random piece of data and checking of the Data Connector returns it.
Public methodPingAsync Communicates to the Data Connector asynchronously to see if it is responsive. This is done by sending a random piece of data and checking of the Data Connector returns it.
Public methodPollForHandrecords Polls the Data Connector synchronously for new handrecords for the session,
Public methodPollForHandrecordsAsync Polls the Data Connector asynchronously for new handrecords for the session,
Public methodPollForParticipations Polls the client queue synchronously for new participations for the specified session.
Public methodPollForParticipationsAsync Polls the client queue asynchronously for new participations for the specified session.
Public methodPollForPlayerData Polls the client queue asynchronously for new player data for the specified session.
Public methodPollForPlayerDataAsync Polls the client queue asynchronously for new player data for the specified session.
Public methodPollForResults Polls the client queue for new boardresults synchronously. Required. The guid of the session to poll participations for.Poll all results for the session, included ones polled before.
Public methodPollForResultsAsync Polls the client queue for new boardresults asynchronously. Required. The guid of the session to poll participations for.Poll all results for the session, included ones polled before.
Public methodSendBridgemate2Settings Adds or updates the Bridgemate 2 settings for the given sections synchronously. There can and must be one dto per section. The section letters cannot be left out!
Public methodSendBridgemate2SettingsAsync Adds or updates the Bridgemate 2 settings for the given sections asynchronously. There can and must be one dto per section. The section letters cannot be left out.
Public methodSendBridgemate3Settings Adds or updates the Bridgemate 3 settings for the given sections synchronously. There can and must be one dto per section. The section letters cannot be left out!
Public methodSendBridgemate3SettingsAsync Adds or updates the Bridgemate 3 settings for the given sections asynchronously. There can and must be one dto per section. The section letters cannot be left out!
Public methodSendHandrecords Sends handrecords synchronously to the BCS queue.
Public methodSendHandrecordsAsync Sends handrecords asynchronously to the BCS queue.
Public methodSendParticipations Sends participations asynchronously to the BCS queue.
Public methodSendParticipationsAsync Sends participations asynchronously to the BCS queue.
Public methodSendPlayerData Sends PlayerData synchronously to the BCS queue.
Public methodSendPlayerDataAsync Sends PlayerData asynchronously to the BCS queue.
Public methodSendResults Sends boardresults synchronously to the BCS queue
Public methodSendResultsAsync Sends boardresults asynchronously to the BCS queue
Public methodUpdateMovement Instructs BCS synchronously to update the movement for the given section. Be sure to include the movement for the section after its change. BCS will figure out how to adjust its data to enact the change. Mind that board results will be erased for each table starting from the lowest numbered round with different round data.
Public methodUpdateMovementAsync Instructs BCS asynchronously to update the movement for the given section. Be sure to include the movement for the section after its change. BCS will figure out how to adjust its data to enact the change. Mind that board results will be erased for each table starting from the lowest numbered round with different round data.
Public methodUpdateScoringGroups Instructs BCS synchronously to update the scoringgroups. This can be done to change the scoring method or to rearrange the sections that are attached to them.
Public methodUpdateScoringGroupsAsync Instructs BCS asynchronously to update the scoringgroups. This can be done to change the scoring method or to rearrange the sections that are attached to them.
Top
Fields
 NameDescription
Public fieldPipeName The name of the pipe that handles the bidirectional communication with the Data Connector.
Public fieldStatic memberScoringProgramClientLogger The logger for this class.
Top
See Also