private void mnuItemPatterns_Click(object sender, EventArgs e)
        {
            var mclsSelected = (clsDatasetTreeNode)ctltreeView.SelectedNode.Tag;

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

            if (!ValidateIsPlottable(mclsSelected, 2))
            {
                return;
            }

            #region Hook Threading Events
            m_BackgroundWorker.DoWork             += m_BackgroundWorker_SearchPatterns;
            m_BackgroundWorker.RunWorkerCompleted += m_BackgroundWorker_PatternSearchCompleted;
            #endregion

            mclsPatternPar = new clsPatternSearchPar();

            var datasetNameInR = mclsSelected.mstrRdatasetName;
            mclsPatternPar.Rdataset        = datasetNameInR;
            mclsPatternPar.mstrDatasetName = mclsSelected.mstrDataText;
            mclsPatternPar.Datasets        = clsDataTable.DataTableColumns(mclsSelected.mDTable, datasetNameInR);

            var mstrnum = DAnTE.ExtraControls.InputBox.Show("How many patterns (1 ~ 6)?", "Number", "2");
            if (mstrnum.Length > 0)
            {
                var mfrmPatterns = new frmPatterns(mclsPatternPar);

                try
                {
                    int N = Convert.ToInt16(mstrnum);
                    if (N < 7)
                    {
                        mfrmPatterns.NumPatterns = N;
                    }
                    else
                    {
                        throw new System.ArgumentException("Number of patterns should be at most 6");
                    }

                    var res = mfrmPatterns.ShowDialog();
                    if (res == DialogResult.OK)
                    {
                        mclsPatternPar = mfrmPatterns.clsPatternPar;
                        Add2AnalysisHTable(mclsPatternPar, "Pattern_Search");

                        m_BackgroundWorker.RunWorkerAsync(mclsPatternPar.Rcmd);
                        mfrmShowProgress.Message = "Pattern Searching ...";
                        mfrmShowProgress.ShowDialog();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Invalid entry ;-(" + Environment.NewLine + ex.Message, "Invalid",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

            #region Unhook Threading Events
            m_BackgroundWorker.DoWork             -= m_BackgroundWorker_SearchPatterns;
            m_BackgroundWorker.RunWorkerCompleted -= m_BackgroundWorker_PatternSearchCompleted;
            #endregion
        }
        private void mnuItemPatterns_Click(object sender, EventArgs e)
        {
            var mclsSelected = (clsDatasetTreeNode)ctltreeView.SelectedNode.Tag;

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

            if (!ValidateIsPlottable(mclsSelected, 2))
            {
                return;
            }

            #region Hook Threading Events
            m_BackgroundWorker.DoWork += m_BackgroundWorker_SearchPatterns;
            m_BackgroundWorker.RunWorkerCompleted += m_BackgroundWorker_PatternSearchCompleted;
            #endregion

            mclsPatternPar = new clsPatternSearchPar();

            var datasetNameInR = mclsSelected.mstrRdatasetName;
            mclsPatternPar.Rdataset = datasetNameInR;
            mclsPatternPar.mstrDatasetName = mclsSelected.mstrDataText;
            mclsPatternPar.Datasets = clsDataTable.DataTableColumns(mclsSelected.mDTable, datasetNameInR);

            var mstrnum = DAnTE.ExtraControls.InputBox.Show("How many patterns (1 ~ 6)?", "Number", "2");
            if (mstrnum.Length > 0)
            {
                var mfrmPatterns = new frmPatterns(mclsPatternPar);

                try
                {
                    int N = Convert.ToInt16(mstrnum);
                    if (N < 7)
                        mfrmPatterns.NumPatterns = N;
                    else
                        throw new System.ArgumentException("Number of patterns should be at most 6");

                    var res = mfrmPatterns.ShowDialog();
                    if (res == DialogResult.OK)
                    {
                        mclsPatternPar = mfrmPatterns.clsPatternPar;
                        Add2AnalysisHTable(mclsPatternPar, "Pattern_Search");

                        m_BackgroundWorker.RunWorkerAsync(mclsPatternPar.Rcmd);
                        mfrmShowProgress.Message = "Pattern Searching ...";
                        mfrmShowProgress.ShowDialog();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Invalid entry ;-(" + Environment.NewLine + ex.Message, "Invalid",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

            #region Unhook Threading Events
            m_BackgroundWorker.DoWork -= m_BackgroundWorker_SearchPatterns;
            m_BackgroundWorker.RunWorkerCompleted -= m_BackgroundWorker_PatternSearchCompleted;
            #endregion
        }