Esempio n. 1
0
 public static SortedTargetsFrm CreateInstance(double[] scores, string[] names)
 {
     if (frm == null || frm.IsDisposed)
     {
         frm = new SortedTargetsFrm(scores, names);
     }
     return(frm);
 }
Esempio n. 2
0
 public static SortedTargetsFrm CreateInstance()
 {
     if (frm == null || frm.IsDisposed)
     {
         frm = new SortedTargetsFrm();
     }
     return(frm);
 }
Esempio n. 3
0
 public static SortedTargetsFrm CreateInstance(List <SortedTargetsParas> list)
 {
     if (frm == null || frm.IsDisposed)
     {
         frm = new SortedTargetsFrm(list);
     }
     return(frm);
 }
Esempio n. 4
0
        /// <summary>
        /// 对计算结果进行排序
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Sort_Click(object sender, EventArgs e)
        {
            double[] arr_Scores  = null;
            string[] arr_TgtName = null;
            int      counterFlag = 0;

            PublicValues.GeoParas = "";
            PublicValues.EngParas = "";
            PublicValues.EcoParas = "";
            //SortedTargetsFrm stf = new SortedTargetsFrm(arr);
            PublicValues.ArrGeoParas = new string[lstBx_Selected_GeoPara.Items.Count];
            foreach (string str in lstBx_Selected_GeoPara.Items)
            {
                PublicValues.ArrGeoParas[counterFlag] = str;
                counterFlag++;
                if (counterFlag != lstBx_Selected_GeoPara.Items.Count)
                {
                    PublicValues.GeoParas += str + ",";
                }
                else
                {
                    PublicValues.GeoParas += str + ";";
                }
            }

            //将所有参数对应的权重值赋值给对应的参数,并形成一个字典变量,以供后面绘图时调用
            //此目的是为了绘制柱状图时,所用参数对应 相应的权重值
            PublicValues.DicGeoP_W = new Dictionary <string, double>();
            PublicValues.DicEngP_W = new Dictionary <string, double>();
            PublicValues.DicEcoP_W = new Dictionary <string, double>();
            for (int i = 0; i < geoParasAll.Length; i++)
            {
                PublicValues.DicGeoP_W.Add(geoParasAll[i], (double)PublicValues.ArrGeoWgt[i]);
                if (i < engParasAll.Length)
                {
                    PublicValues.DicEngP_W.Add(engParasAll[i], (double)PublicValues.ArrEngWgt[i]);
                }
                if (i < ecoParasAll.Length)
                {
                    PublicValues.DicEcoP_W.Add(ecoParasAll[i], (double)PublicValues.ArrEcoWgt[i]);
                }
            }

            counterFlag = 0;
            PublicValues.ArrEngParas = new string[lstBx_Selected_EngPara.Items.Count];
            foreach (string str in lstBx_Selected_EngPara.Items)
            {
                PublicValues.ArrEngParas[counterFlag] = str;
                counterFlag++;
                if (counterFlag != lstBx_Selected_EngPara.Items.Count)
                {
                    PublicValues.EngParas += str + ",";
                }
                else
                {
                    PublicValues.EngParas += str + ";";
                }
            }
            counterFlag = 0;
            PublicValues.ArrEcoParas = new string[lstBx_Selected_EcoPara.Items.Count];
            foreach (string str in lstBx_Selected_EcoPara.Items)
            {
                PublicValues.ArrEcoParas[counterFlag] = str;
                counterFlag++;
                if (counterFlag != lstBx_Selected_EcoPara.Items.Count)
                {
                    PublicValues.EcoParas += str + ",";
                }
                else
                {
                    PublicValues.EcoParas += str + ";";
                }
            }
            if (chkFlag)
            {
                List <SortedTargetsParas> lst_STP = BlockGrade(lst_Tgt);
                int counter = lst_STP.Count;
                arr_Scores  = new double[counter];
                arr_TgtName = new string[counter];
                lst_STP.Sort((x, y) => x.para_TotalScores.CompareTo(y.para_TotalScores));
                foreach (SortedTargetsParas sBp in lst_STP)
                {
                    sBp.para_Rank = counter;
                    counter--;
                }
                lst_STP.Sort((x, y) => x.para_Rank.CompareTo(y.para_Rank));
                arr_Scores  = lst_STP.Select(x => x.para_TotalScores).ToArray();
                arr_TgtName = lst_STP.Select(x => x.para_Tgt).ToArray();
                //SortedTargetsFrm stf = new SortedTargetsFrm(arr_Scores,arr_TgtName);
                SortedTargetsFrm stf = SortedTargetsFrm.CreateInstance(arr_Scores, arr_TgtName);
                stf.dgv_Tgt_Sorted.DataSource = DataSourceToDataTable.GetListToDataTable(lst_STP);
                stf.Show();
                btn_GenerateReport.Enabled = true;
            }
            else
            {
                MessageBox.Show("尚未进行参数矩阵的检验计算操作,所有参数的权重值为 0 。", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }