Beispiel #1
0
 public frmWilcoxonPar(clsWilcoxonPar clsWilcox)
 {
     InitializeComponent();
     mclsWilcoxonPar = clsWilcox;
 }
        private void menuItemWilcox_Click(object sender, EventArgs e)
        {
            var mclsSelected = (clsDatasetTreeNode)ctltreeView.SelectedNode.Tag;

            if (!t_testPossible() || !mhtDatasets.ContainsKey("Factors"))
            {
                MessageBox.Show("There is not a single factor with exactly two levels; " +
                                Environment.NewLine + " cannot perform the Wilcoxon Test.", "No suitable factors",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

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

            #region Hook Threading Events

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

            #endregion

            mclsWilcoxPar = new clsWilcoxonPar();
            Rdataset = mclsSelected.mstrRdatasetName;

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

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

            var mfrmWilcoxPar = new frmWilcoxonPar(mclsWilcoxPar);
            if (mclsFactors.mDTable != null)
            {
                mfrmWilcoxPar.FactorList = marrFactorInfo;
                mfrmWilcoxPar.PopulateListBox = clsDataTable.DataTableRows(mclsFactors.mDTable);

                if (mfrmWilcoxPar.ShowDialog() == DialogResult.OK)
                {
                    mclsWilcoxPar = mfrmWilcoxPar.clsWilcoxonPar;

                    Add2AnalysisHTable(mclsWilcoxPar, "Wilcoxon_Test");

                    m_BackgroundWorker.RunWorkerAsync(mclsWilcoxPar.Rcmd);
                    mfrmShowProgress.Message = "Performing Wilcoxon test ...";
                    mfrmShowProgress.ShowDialog();
                }
            }

            #region Unhook Threading Events

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

            #endregion
        }