private void DefineRESETIntervallForAllHandlers(int Interval)
        {
            IEnumerator enumm = this._variablesHandlerContainer.GetEnumerator();
            CF_DPE_PublicationVariableSimulationHandler handler = default(CF_DPE_PublicationVariableSimulationHandler);

            while (enumm.MoveNext())
            {
                handler = (CF_DPE_PublicationVariableSimulationHandler)((DictionaryEntry)enumm.Current).Value;
                handler.DefineRESETRateInterval(Interval);
            }
        }
        internal void StopAll_DATA_RESET_Simulations()
        {
            IEnumerator enumm = this._variablesHandlerContainer.GetEnumerator();
            CF_DPE_PublicationVariableSimulationHandler handler = default(CF_DPE_PublicationVariableSimulationHandler);

            while (enumm.MoveNext())
            {
                handler = (CF_DPE_PublicationVariableSimulationHandler)((DictionaryEntry)enumm.Current).Value;
                handler.StopRESETimulation();
            }
        }
        public CF_DPE_PublicationPostHandler(DPE_DataPublicationsClient client, string publicationName, ClientHandlerData ClientHandlerData)
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            // Add any initialization after the InitializeComponent() call.
            this._client                         = client;
            this._publicationName                = publicationName;
            this._ClientHandlerData              = ClientHandlerData;
            this._variablesHandlerContainer      = new CF_DPE_PublicationVariableSimulationHandlerContainer(this._client);
            this._variablesHandlerContainer.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlVariablesHandler.Controls.Add(this._variablesHandlerContainer);

            PostedPublicationDefinitionData data = this._ClientHandlerData.GetPublicationPostDefinition(this._publicationName);

            if (!(data == null))
            {
                IEnumerator enumm = data.VariablesDefinitionContainer.GetEnumerator();
                PublicationVariableDefinitionData var = null;
                while (enumm.MoveNext())
                {
                    var = (PublicationVariableDefinitionData)enumm.Current;
                    this._variablesHandlerContainer.AddVariableHandler(this._publicationName, ref var);
                }

                enumm = data.VariablesDefinitionContainer.GetEnumerator();
                CF_DPE_PublicationVariableSimulationHandler simHadler = null;
                while (enumm.MoveNext())
                {
                    var       = (PublicationVariableDefinitionData)enumm.Current;
                    simHadler = this._variablesHandlerContainer.GetVariableSimulationHandler(var.VariableName);
                    if (var.DataUPDATESimulationStatus == PublicationVariableDefinitionData.variableSimulationStatus.running)
                    {
                        simHadler.StartUPDATESimulation();
                    }
                    if (var.DataRESETSimulationStatus == PublicationVariableDefinitionData.variableSimulationStatus.running)
                    {
                        simHadler.StartRESETSimulation();
                    }
                }
            }
        }
        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"));
            }
        }
        public void Button1_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (Interaction.MsgBox("Reset Statistics?", MsgBoxStyle.YesNo, null) == MsgBoxResult.Yes)
                {
                    IEnumerator enumm = this._variablesHandlerContainer.GetEnumerator();
                    CF_DPE_PublicationVariableSimulationHandler handler = default(CF_DPE_PublicationVariableSimulationHandler);

                    while (enumm.MoveNext())
                    {
                        handler = (CF_DPE_PublicationVariableSimulationHandler)((DictionaryEntry)enumm.Current).Value;
                        handler.ResetStatistics();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public void RemoveVariableHandler(string variableName)
        {
            if (this._variablesTabPagesTable.ContainsKey(variableName))
            {
                System.Windows.Forms.TabPage tab = default(System.Windows.Forms.TabPage);
                tab = (System.Windows.Forms.TabPage) this._variablesTabPagesTable[variableName];
                this.tabVariablesSimulationHandler.TabPages.Remove(tab);
                try
                {
                    tab.Dispose();
                }
                catch (Exception)
                {
                }
                CF_DPE_PublicationVariableSimulationHandler handler = default(CF_DPE_PublicationVariableSimulationHandler);
                handler = (CF_DPE_PublicationVariableSimulationHandler)this._handlersTable[variableName];

                handler.SimulationStatusChanged -= EventHandling_VariableSimulationHandler_simulationStatusChanged;
                handler.DisposeHandler();

                this._variablesTabPagesTable.Remove(variableName);
                this._handlersTable.Remove(variableName);
            }
        }
 private void EventHandling_VariableSimulationHandler_simulationStatusChanged(CF_DPE_PublicationVariableSimulationHandler handler)
 {
     ClientHandlersDataContainer.GetInstance().SaveData();
 }