Exemplo n.º 1
0
        private void menuItemKW_Click(object sender, EventArgs e)
        {
            var selectedNodeTag = (clsDatasetTreeNode)ctltreeView.SelectedNode.Tag;

            if (!ValidateFactorsDefined("use the Kruskal-Walis Test"))
            {
                return;
            }

            if (!ValidateDataMatrixTableSelected(selectedNodeTag))
            {
                return;
            }

            #region Hook Threading Events

            m_BackgroundWorker.DoWork             += m_BackgroundWorker_KW;
            m_BackgroundWorker.RunWorkerCompleted += m_BackgroundWorker_ANOVACompleted;

            #endregion

            mclsKWpar = new clsKruskalWPar();
            Rdataset  = selectedNodeTag.mstrRdatasetName;

            mclsKWpar.Rdataset        = Rdataset;
            mclsKWpar.mstrDatasetName = selectedNodeTag.mstrDataText;
            var factorTable = mhtDatasets["Factors"];
            clsDataTable.DataTableRows(factorTable.mDTable);

            if (!ValidateDataMatrixTableSelected(selectedNodeTag))
            {
                return;
            }

            var kwParams = new frmKruskalWpar(mclsKWpar);
            if (factorTable.mDTable != null)
            {
                kwParams.PopulateListBox = clsDataTable.DataTableRows(factorTable.mDTable);
                if (kwParams.ShowDialog() == DialogResult.OK)
                {
                    mclsKWpar = kwParams.clsKruskalWPar;

                    Add2AnalysisHTable(mclsKWpar, "Kruskal-Walis_Test");

                    m_BackgroundWorker.RunWorkerAsync(mclsKWpar.Rcmd);
                    mfrmShowProgress.Reset("Performing KW test ...");
                    mfrmShowProgress.ShowDialog();
                }
            }

            #region Unhook Threading Events

            m_BackgroundWorker.DoWork             -= m_BackgroundWorker_KW;
            m_BackgroundWorker.RunWorkerCompleted -= m_BackgroundWorker_ANOVACompleted;

            #endregion
        }
        private void menuItemKW_Click(object sender, EventArgs e)
        {
            var mclsSelected = (clsDatasetTreeNode)ctltreeView.SelectedNode.Tag;

            if (!ValidateFactorsDefined("use the Kruskal-Walis Test"))
            {
                return;
            }

            if (!ValidateDataMatrixTableSelected(mclsSelected))
            {
                return;
            }

            #region Hook Threading Events
            m_BackgroundWorker.DoWork += m_BackgroundWorker_KW;
            m_BackgroundWorker.RunWorkerCompleted += m_BackgroundWorker_ANOVACompleted;
            #endregion

            mclsKWpar = new clsKruskalWPar();
            Rdataset = mclsSelected.mstrRdatasetName;

            mclsKWpar.tempFile = mRTempFilePath;
            mclsKWpar.Rdataset = Rdataset;
            mclsKWpar.mstrDatasetName = mclsSelected.mstrDataText;
            var mclsFactors = mhtDatasets["Factors"];
            mclsKWpar.marrFactors = clsDataTable.DataTableRows(mclsFactors.mDTable);

            if (!ValidateDataMatrixTableSelected(mclsSelected))
            {
                return;
            }

            var mfrmKWPar = new frmKruskalWpar(mclsKWpar);
            if (mclsFactors.mDTable != null)
            {
                mfrmKWPar.PopulateListBox = clsDataTable.DataTableRows(mclsFactors.mDTable);
                if (mfrmKWPar.ShowDialog() == DialogResult.OK)
                {
                    mclsKWpar = mfrmKWPar.clsKruskalWPar;

                    Add2AnalysisHTable(mclsKWpar, "Kruskal-Walis_Test");

                    m_BackgroundWorker.RunWorkerAsync(mclsKWpar.Rcmd);
                    mfrmShowProgress.Message = "Performing KW test ...";
                    mfrmShowProgress.ShowDialog();
                }
            }

            #region Unhook Threading Events
            m_BackgroundWorker.DoWork -= m_BackgroundWorker_KW;
            m_BackgroundWorker.RunWorkerCompleted -= m_BackgroundWorker_ANOVACompleted;
            #endregion
        }