Пример #1
0
        private void exportTextToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool GetAnswer =
                MessageBox.Show("Export answer or not? ", "Export type",
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes;
            StringBuilder stringBuilder = new StringBuilder();

            //取每个矩阵出来进行导出
            for (int index = 0; index < listBoxMatrix.Items.Count; index++)
            {
                //取出当前矩阵和层次
                TreeNodeCollection CurrentLayer = ((TreeNodeCollection[])LayerList.ToArray(typeof(TreeNodeCollection)))[index + 1];
                string[,] CurrentMatrix = ((string[][, ])MatrixList.ToArray(typeof(string[, ])))[index + 1];
                if (CurrentMatrix != null)
                {
                    string[] FactorsString = new string[CurrentLayer.Count];
                    int      i             = 0;
                    //取出该层因素
                    foreach (TreeNode node in CurrentLayer)
                    {
                        FactorsString[i] = node.Text;
                        i++;
                    }
                    FormSurvey formSurvey = new FormSurvey(FactorsString, CurrentLayer[0].Parent.Text, CurrentMatrix);
                    formSurvey.Show();
                    stringBuilder.Append("------------------------------------------------\r\n");
                    stringBuilder.Append(formSurvey.getAllQuestionText(needAnswerOrNot: GetAnswer));
                    formSurvey.Close();
                }
            }
            FormText formText = new FormText();

            formText.Show(stringBuilder.ToString(), "SurveyText");
        }
Пример #2
0
        private void pairWiseToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (listBoxMatrix.SelectedIndex != -1)
            {
                //取出被选层矩阵因素,构造因素字符串数组
                //下面这一行表示从选择的列表框中取出选中的行号索引,到对应的层去找那个孩子集合,取孩子个数,即因素个数,构造相同大小的因素字符串数组
                TreeNodeCollection CurrentLayer = ((TreeNodeCollection[])LayerList.ToArray(typeof(TreeNodeCollection)))[listBoxMatrix.SelectedIndex + 1];
                string[,] CurrentMatrix = ((string[][, ])MatrixList.ToArray(typeof(string[, ])))[listBoxMatrix.SelectedIndex + 1];

                if (CurrentMatrix == null)
                {
                    MessageBox.Show("No matrix!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, 0);
                    return;  //如果矩阵为空,不进行下面的操作
                }

                string[] FactorsString = new string[CurrentLayer.Count];
                int      i             = 0;
                //取出该层因素
                foreach (TreeNode node in CurrentLayer)
                {
                    FactorsString[i] = node.Text;
                    i++;
                }
                FormSurvey formSurvey = new FormSurvey(FactorsString, CurrentLayer[0].Parent.Text, CurrentMatrix);
                formSurvey.Show();
            }
        }