コード例 #1
0
        public void Button8_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEnumerator enumm       = default(IEnumerator);
                string      listElement = "";


                if (this.lstPostedPublicationVariables.Items.Count >= 0)
                {
                    enumm = this.lstPostedPublicationVariables.Items.GetEnumerator();

                    while (enumm.MoveNext())
                    {
                        listElement = System.Convert.ToString(enumm.Current);

                        string VariableName = this.GetSelectedPublicationVariableName(listElement);
                        DPE_ServerDefs.PublicationVariableDataType varType = this.GetSelectedPublicationVariableDataType(listElement);

                        //modifies the handler data for the
                        publicationsPosting.PublicationVariableDefinitionData varDef = this._ClientHandlerData.GetPublicationPostDefinition(this._publicationName).GetVariableDefinition(VariableName);
                        this._variablesHandlerContainer.AddVariableHandler(this._publicationName, ref varDef);
                    }


                    ClientHandlersDataContainer.GetInstance().SaveData();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        public void btnOK_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (this.txtPublicationName.Text.Length <= 0)
                {
                    this.txtPublicationName.Focus();
                    throw (new Exception("No Publication Name specified"));
                }

                if (this.lstBoxPublicationVariables.Items.Count <= 0)
                {
                    throw (new Exception("No variables specified for the publication"));
                }

                DPE_ClientPublicationDefinition publication = default(DPE_ClientPublicationDefinition);

                if (this.txtPublicationsGroup.Text.Length > 0)
                {
                    publication = new DPE_ClientPublicationDefinition(this.txtPublicationsGroup.Text, this.txtPublicationName.Text);
                }
                else
                {
                    publication = new DPE_ClientPublicationDefinition(this.txtPublicationName.Text);
                }

                string varName = "";
                DPE_ServerDefs.PublicationVariableDataType varType = default(DPE_ServerDefs.PublicationVariableDataType);
                IEnumerator enumm = this._publicationVariables.GetEnumerator();
                while (enumm.MoveNext())
                {
                    varName = System.Convert.ToString(((DictionaryEntry)enumm.Current).Key);
                    varType = (DPE_ServerDefs.PublicationVariableDataType)(((DictionaryEntry)enumm.Current).Value);
                    publication.AddVaribleToPublication(varName, varType);
                }

                this._client.CreateDataPublication(publication);

                //creation of support object to serialize publicatio creation data
                this._publicationsPostingData = new publicationsPosting.PostedPublicationDefinitionData(publication.PublicationName);
                enumm = this._publicationVariables.GetEnumerator();
                while (enumm.MoveNext())
                {
                    varName = System.Convert.ToString(((DictionaryEntry)enumm.Current).Key);
                    varType = (DPE_ServerDefs.PublicationVariableDataType)(((DictionaryEntry)enumm.Current).Value);
                    publicationsPosting.PublicationVariableDefinitionData def = new publicationsPosting.PublicationVariableDefinitionData(varName, varType);
                    this._publicationsPostingData.AddVariableDefinition(def);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.DialogResult = System.Windows.Forms.DialogResult.None;
            }
        }
コード例 #3
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);
            }
        }
コード例 #4
0
        public void btnOK_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (this.txtPublicationName.Text.Length <= 0)
                {
                    this.txtPublicationName.Focus();
                    throw (new Exception("No Publication Name specified"));
                }


                this.ValidateSelectedType();

                DPE_ClientPublicationDefinition publication = default(DPE_ClientPublicationDefinition);

                if (this.txtPublicationsGroup.Text.Length > 0)
                {
                    publication = new DPE_ClientPublicationDefinition(this.txtPublicationsGroup.Text, this.txtPublicationName.Text);
                }
                else
                {
                    publication = new DPE_ClientPublicationDefinition(this.txtPublicationName.Text);
                }



                this._publicationsPostingData = new publicationsPosting.PostedPublicationDefinitionData(publication.PublicationName);


                string variableName = "";
                DPE_ServerDefs.PublicationVariableDataType varType = default(DPE_ServerDefs.PublicationVariableDataType);

                for (this._variablesCount = 1; this._variablesCount <= this.nudNumberOfVariables.Value; this._variablesCount++)
                {
                    varType      = this.GetRandomDataType();
                    variableName = this.txtPublicationName.Text + "_VAR_" + System.Convert.ToString(this._variablesCount);
                    publication.AddVaribleToPublication(variableName, varType);

                    publicationsPosting.PublicationVariableDefinitionData def = new publicationsPosting.PublicationVariableDefinitionData(variableName, varType);
                    this._publicationsPostingData.AddVariableDefinition(def);
                }

                this._client.CreateDataPublication(publication);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.DialogResult = System.Windows.Forms.DialogResult.None;
            }
        }
        public void AddVariableHandler(string publicationNAme, ref publicationsPosting.PublicationVariableDefinitionData variableDefinition)
        {
            if (!this._handlersTable.ContainsKey(variableDefinition.VariableName))
            {
                System.Windows.Forms.TabPage TabPage = new System.Windows.Forms.TabPage(variableDefinition.VariableName);
                CF_DPE_PublicationVariableSimulationHandler handler = new CF_DPE_PublicationVariableSimulationHandler(this._client, publicationNAme, variableDefinition);
                handler.SimulationStatusChanged += EventHandling_VariableSimulationHandler_simulationStatusChanged;
                handler.Dock = System.Windows.Forms.DockStyle.Fill;
                TabPage.Controls.Add(handler);

                TabPage_Add(this.tabVariablesSimulationHandler, TabPage);

                this._variablesTabPagesTable.Add(variableDefinition.VariableName, TabPage);
                this._handlersTable.Add(variableDefinition.VariableName, handler);
            }
            else
            {
                throw (new Exception("The variable \'" + variableDefinition.VariableName + "\' already has a handler"));
            }
        }
コード例 #6
0
        public CF_DPE_PublicationVariableSimulationHandler(DPE_DataPublicationsClient client, string publicationName, publicationsPosting.PublicationVariableDefinitionData variableDefinition)
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            // Add any initialization after the InitializeComponent() call.
            this._publicationName    = publicationName;
            this._variableDefinition = variableDefinition;
            this._client             = client;
            if (!this._client.IsConnected)
            {
                this._client.ConnectToServer();
            }
            variableDefinition.SimulationHandlerExists = true;

            this._statsUpdateTimer           = new System.Timers.Timer(250);
            this._statsUpdateTimer.Elapsed  += this._statsUpdateTimer_Elapsed;
            this._statsUpdateTimer.AutoReset = false;
            this._statsUpdateTimer.Stop();
        }
コード例 #7
0
        public void Button7_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (this.lstPostedPublicationVariables.SelectedIndex >= 0)
                {
                    string VariableName = this.GetSelectedPublicationVariableName();
                    DPE_ServerDefs.PublicationVariableDataType varType = this.GetSelectedPublicationVariableDataType();

                    //modifies the handler data for the
                    publicationsPosting.PublicationVariableDefinitionData varDef = this._ClientHandlerData.GetPublicationPostDefinition(this._publicationName).GetVariableDefinition(VariableName);
                    this._variablesHandlerContainer.AddVariableHandler(this._publicationName, ref varDef);

                    ClientHandlersDataContainer.GetInstance().SaveData();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }