Esempio n. 1
0
        public CF_DPE_ClientHandler(ClientHandlerData data)
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();
            // Add any initialization after the InitializeComponent() call.
            this._client = new DPE_DataPublicationsClient(data.ClientName);
            this._client.ConnectionWithSTXDataServerLost += this.ConnectionWithServerLost;
            if (!this._client.IsConnected)
            {
                this._client.ConnectToServer();
            }

            this._ClientHandlerData                        = data;
            this.lblSErverConnectionStatus.Text            = "Status: Connected To Server";
            this._PublicationsHandlersContainer            = new CF_DPE_PublicationsPostHandlersContainer(this._client, this._ClientHandlerData);
            this._PublicationsConnectionsHandlersContainer = new CF_DPE_PublicationsSubscriptionsHandlersContainer(this._client, this._ClientHandlerData);


            //creates all the publications configured for the client
            IEnumerator enumm = data.PublicationsPostEnumerator;

            publicationsPosting.PostedPublicationDefinitionData pubPostData = null;

            while (enumm.MoveNext())
            {
                pubPostData = (publicationsPosting.PostedPublicationDefinitionData)enumm.Current;
                DPE_ClientPublicationDefinition publication = new DPE_ClientPublicationDefinition(pubPostData.PublicationName);

                IEnumerator enumm2 = pubPostData.VariablesDefinitionContainer.GetEnumerator();
                publicationsPosting.PublicationVariableDefinitionData varDAta = null;
                while (enumm2.MoveNext())
                {
                    varDAta = (publicationsPosting.PublicationVariableDefinitionData)enumm2.Current;
                    publication.AddVaribleToPublication(varDAta.VariableName, varDAta.DataType);
                }

                this._client.CreateDataPublication(publication);

                this._PublicationsHandlersContainer.AddPublicationHandler(publication.PublicationName);
            }

            //creates all the connections with publications configured for the client
            IEnumerator pubCnnEnumm = data.PublicationsConnectionsEnumerator;

            publicationsConnection.PublicationConnectionData cnndta = default(publicationsConnection.PublicationConnectionData);

            while (pubCnnEnumm.MoveNext())
            {
                cnndta = (publicationsConnection.PublicationConnectionData)pubCnnEnumm.Current;
                this._client.ConnectToADataPublication(cnndta.PublicationName, cnndta.ConnectionMode);
                this._PublicationsConnectionsHandlersContainer.AddPublicationConnectionHandler(cnndta.PublicationName);
            }
        }
Esempio n. 2
0
        public CF_DPE_ClientHandler(string clientName, bool DataStatisticsHandling)
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();
            // Add any initialization after the InitializeComponent() call.
            clientName   = clientName.ToUpper();
            this._client = new DPE_DataPublicationsClient(clientName);
            this._client.ConnectionWithSTXDataServerLost += this.ConnectionWithServerLost;
            if (!this._client.IsConnected)
            {
                this._client.ConnectToServer();
            }

            this._ClientHandlerData = new ClientHandlerData(clientName, DataStatisticsHandling);

            this.lblSErverConnectionStatus.Text            = "Status: Connected To Server";
            this._PublicationsHandlersContainer            = new CF_DPE_PublicationsPostHandlersContainer(this._client, this._ClientHandlerData);
            this._PublicationsConnectionsHandlersContainer = new CF_DPE_PublicationsSubscriptionsHandlersContainer(this._client, this._ClientHandlerData);
        }