Esempio n. 1
0
 public frmKruskalWpar(clsKruskalWPar clsKW)
 {
     InitializeComponent();
     mclsKruskalWPar = clsKW;
 }
        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
        }